<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:Fluent="clr-namespace:Fluent" xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:Internal="clr-namespace:Fluent.Internal" xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" xmlns:conv="clr-namespace:Fluent.Metro.Converters" xmlns:Behaviours="clr-namespace:Fluent.Metro.Behaviours">
  <SolidColorBrush x:Key="RibbonTopBorderBrush" Color="#FFD4D4D4" />
  <SolidColorBrush x:Key="RibbonBackgoundBrush" Color="White" />
  <SolidColorBrush x:Key="ActiveTabBackgroundBrush" Color="White" />
  <LinearGradientBrush x:Key="GroupSeparatorBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#00F6F7F8" Offset="0" />
    <GradientStop Color="#FFD4D4D4" Offset="0.1" />
    <GradientStop Color="#FFD4D4D4" Offset="0.9" />
    <GradientStop Color="#00B0B6BC" Offset="1" />
    <GradientStop Color="#00D4D4D4" Offset="0.901" />
    <GradientStop Color="#00E7E8E9" Offset="0.099" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="GroupSeparatorBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFDFDFD" Offset="0" />
    <GradientStop Color="White" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="DefaultFontBrush" Color="#FF3B3B3B" />
  <SolidColorBrush x:Key="BackstageFontBrush" Color="White" />
  <SolidColorBrush x:Key="GroupBoxFontBrush" Color="#FF666D7C" />
  <SolidColorBrush x:Key="TabItemSelectedFontBrush" Color="#FF212121" />
  <SolidColorBrush x:Key="TabItemFontBrush" Color="#FF212121" />
  <LinearGradientBrush x:Key="GroupHoverBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFEFEFE" Offset="0" />
    <GradientStop Color="#FFE3E7EE" Offset="1" />
  </LinearGradientBrush>
  <RadialGradientBrush x:Key="GroupHighlightBrush" Center="0.505,1" GradientOrigin="0.505,1">
    <GradientStop Color="#BFFFFFFF" />
    <GradientStop Offset="1" />
  </RadialGradientBrush>
  <SolidColorBrush x:Key="StatusBarBorderBrushBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" />
  <SolidColorBrush x:Key="StatusBarInnerBorderBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" />
  <SolidColorBrush x:Key="StatusBarInnerBackgroundBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" />
  <LinearGradientBrush x:Key="StatusBarSeparatorBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFC1C5C9" Offset="0" />
    <GradientStop Color="#FFACAFB3" Offset="1" />
    <GradientStop Color="#FF777B7F" Offset="0.5" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="StatusBarSeparatorBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFEAEDF1" Offset="0" />
    <GradientStop Color="#FFC5C8CD" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="WindowBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFEBEDF0" Offset="0" />
    <GradientStop Color="#FFBABEC2" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ScrollButtonDefaultBorderBrush" Color="#FFABABAB" />
  <SolidColorBrush x:Key="ScrollButtonDefaultBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="ScrollButtonHoverBorderBrush" Color="#FF777777" />
  <SolidColorBrush x:Key="ScrollButtonHoverBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="ScrollButtonPressedBorderBrush" Color="#FF777777" />
  <SolidColorBrush x:Key="ScrollButtonPressedBackgroundBrush" Color="#FFF0F0F0" />
  <SolidColorBrush x:Key="ScrollOutterBorderBrush" Color="#FFABABAB" />
  <SolidColorBrush x:Key="ScrollOutterBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="ScrollInnerBorderBrush" Color="#00000000" />
  <SolidColorBrush x:Key="ScrollInnerBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="ScrollOverOutterBorderBrush" Color="#FF777777" />
  <SolidColorBrush x:Key="ScrollOverOutterBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="ScrollPressedOutterBorderBrush" Color="#FF8A9199" />
  <SolidColorBrush x:Key="ScrollPressedOutterBackgroundBrush" Color="#FFF0F0F0" />
  <SolidColorBrush x:Key="ScrollBackgroundBrush" Color="#FFEDEDED" />
  <SolidColorBrush x:Key="ScrollVerticalBackgroundBrush" Color="#FFEDEDED" />
  <SolidColorBrush x:Key="TextBoxBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="TextBoxHoverBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="TextBoxBorderBrush" Color="#FFD3D6D9" />
  <SolidColorBrush x:Key="TextBoxHoverBorderBrush" Color="#FFBBBFC4" />
  <SolidColorBrush x:Key="TextBoxDisabledBackgroundBrush" Color="#FFFAFAFA" />
  <SolidColorBrush x:Key="TextBoxDisabledBorderBrush" Color="#FFE4E7EB" />
  <SolidColorBrush x:Key="InRibbonGalleryBorderBrush" Color="#FFC6CACD" />
  <SolidColorBrush x:Key="GalleryBackgroundBrush" Color="White" />
  <RadialGradientBrush x:Key="RibbonTabControlTopGradientLeftBrush" RadiusY="1" Center="1,1" GradientOrigin="1,1" RadiusX="1">
    <GradientStop Offset="1" />
    <GradientStop Color="#D8FFFFFF" />
  </RadialGradientBrush>
  <RadialGradientBrush x:Key="RibbonTabControlTopGradientRightBrush" RadiusY="1" Center="0,1" GradientOrigin="0,1" RadiusX="1">
    <GradientStop Offset="1" />
    <GradientStop Color="#D8FFFFFF" />
  </RadialGradientBrush>
  <LinearGradientBrush x:Key="RibbonTabControlTopGradientCenterBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Offset="0" />
    <GradientStop Color="#D8FFFFFF" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="BackstagePanelBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFBFCFD" Offset="0" />
    <GradientStop Color="#FFE0E3E7" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ButtonBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFFFFFF" Offset="0" />
    <GradientStop Color="#FFF1F3F4" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ButtonBorderBrush" Color="#FFC6CACD" />
  <SolidColorBrush x:Key="ButtonDisabledBackgroundBrush" Color="#FFFAFAFA" />
  <SolidColorBrush x:Key="ButtonDisabledBorderBrush" Color="#FFE4E7EB" />
  <LinearGradientBrush x:Key="RibbonSeparatorBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFAFB2B9" Offset="0.522" />
    <GradientStop Color="#00C0C3C8" />
    <GradientStop Color="#00C0C3C8" Offset="1" />
    <GradientStop Color="#66AFB2B9" Offset="0.168" />
    <GradientStop Color="#66A7ADB5" Offset="0.828" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="RibbonSeparatorBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Offset="1" Color="#19FFFFFF" />
    <GradientStop Color="#19EFEFEF" />
    <GradientStop Color="#99F6F6F6" Offset="0.237" />
    <GradientStop Color="#99FBFBFB" Offset="0.741" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="WindowOutterBackgroundBrush" Color="#FFEBEDF0" />
  <SolidColorBrush x:Key="WindowOutterBorderBrush" Color="#FF656D75" />
  <SolidColorBrush x:Key="WindowInnerBorderBrush" Color="White" />
  <LinearGradientBrush x:Key="WindowInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFEBEDF0" Offset="0" />
    <GradientStop Color="#FFE3E6E8" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="WindowContentBorderBrush" Color="#FF878C92" />
  <SolidColorBrush x:Key="WindowInactiveOutterBackgroundBrush" Color="#FFF8F7F7" />
  <LinearGradientBrush x:Key="WindowInactiveInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFCFCFC" Offset="0" />
    <GradientStop Color="#FFFCFCFC" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="CaptionButtonHoverOutterBorderBrush" Color="#FFA6ACB3" />
  <LinearGradientBrush x:Key="CaptionButtonHoverInnerBorderBrush">
    <GradientStop Color="#FFFFFFFF" Offset="0" />
    <GradientStop Color="#FFF2F2F3" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="CaptionButtonHoverInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFFFFFF" Offset="0" />
    <GradientStop Color="#FFE7E8E9" Offset="1" />
    <GradientStop Offset="0.49" Color="#FFFCFCFC" />
    <GradientStop Offset="0.51" Color="#FFF8F8F8" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="CaptionButtonPressedOutterBorderBrush" Color="#FFA6ACB3" />
  <SolidColorBrush x:Key="CaptionButtonPressedInnerBorderBrush" Color="#FFC2C7CE" />
  <LinearGradientBrush x:Key="CaptionButtonPressedInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFDFE4EB" Offset="0" />
    <GradientStop Color="#FFDFE4EB" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ContextMenuBarResizeBorderBrush" Color="#FFDDE7EE" />
  <LinearGradientBrush x:Key="ContextMenuBarResizeBackgoundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="White" Offset="0" />
    <GradientStop Color="#FFD8DBDF" Offset="1" />
    <GradientStop Color="#FFF2F4F5" Offset="0.529" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ScreenTipBorderBrush" Color="#FF767676" />
  <LinearGradientBrush x:Key="ScreenTipBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="White" Offset="0" />
    <GradientStop Color="#FFEAEAF4" Offset="1" />
    <GradientStop Color="#FFF6F6FA" Offset="0.746" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="QuickAccessToolbarPopupBackgrondBrush" Color="#FFE9EDF1" />
  <SolidColorBrush x:Key="QuickAccessToolBarOutterBorderBrush" Color="#FF98A1AB" />
  <SolidColorBrush x:Key="QuickAccessToolBarInnerBorderBrush" Color="#FFDFE3EA" />
  <SolidColorBrush x:Key="QuickAccessToolBarInnerBackgroundBrush" Color="#FFD5D9DE" />
  <SolidColorBrush x:Key="GroupBoxSeparatorBorderBrush" Color="White" />
  <LinearGradientBrush x:Key="GroupBoxSeparatorBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#00C0C3C8" Offset="0" />
    <GradientStop Color="#00C0C3C8" Offset="1" />
    <GradientStop Color="#FFC0C3C8" Offset="0.5" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="RoundButtonBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFF6F7F8" Offset="0" />
    <GradientStop Color="#FFD2D5D9" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="RoundButtonBorderBrush" Color="#808893" />
  <SolidColorBrush x:Key="SliderShadowBrush" Color="White" />
  <SolidColorBrush x:Key="SliderLightenBrush" Color="White" />
  <LinearGradientBrush x:Key="RoundButtonForegroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FF828588" Offset="0" />
    <GradientStop Color="#FF6A6D70" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ResizeGripFront" Color="#FF9DA6B0" />
  <SolidColorBrush x:Key="ResizeGripBack" Color="#FFE6E9ED" />
  <FontFamily x:Key="DefaultFontFamily">Segoe UI</FontFamily>
  <System:Double x:Key="DefaultFontSize">12</System:Double>
  <SolidColorBrush x:Key="BackstageBackgroundBrush" Color="White" />
  <LinearGradientBrush x:Key="BackstagePanelShadowBackgroundBrush" EndPoint="1.012,0">
    <GradientStop Color="#00000000" Offset="0" />
    <GradientStop Color="#19000000" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="BackstageTopBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#3FFFFFFF" Offset="0.49" />
    <GradientStop Color="#3F000000" Offset="0.5" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="BackstageTopOpacityBrush" EndPoint="1,0.5" StartPoint="0,0.5">
    <GradientStop Color="Black" Offset="0" />
    <GradientStop Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ButtonHoverOuterBackgroundBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
  <SolidColorBrush x:Key="ButtonHoverOuterBorderBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
  <SolidColorBrush x:Key="ButtonHoverInnerBackgroundBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
  <SolidColorBrush x:Key="ButtonHoverInnerBorderBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
  <SolidColorBrush x:Key="ButtonPressedOuterBackgroundBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.3" />
  <SolidColorBrush x:Key="ButtonPressedOuterBorderBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.3" />
  <SolidColorBrush x:Key="ButtonPressedInnerBackgroundBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.3" />
  <SolidColorBrush x:Key="ButtonPressedInnerBorderBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.3" />
  <SolidColorBrush x:Key="TransparentBrush" Color="#00000000" />
  <SolidColorBrush x:Key="CheckBoxOutterBorderBrush" Color="#FF898B8C" />
  <SolidColorBrush x:Key="CheckBoxOutterBackgroundBrush" Color="#FFF2F3F5" />
  <SolidColorBrush x:Key="CheckBoxInnerBorderBrush" Color="#FFB6B8BA" />
  <LinearGradientBrush x:Key="CheckBoxInnerBackgroundBrush" EndPoint="0.859,0.848" StartPoint="0.141,0.152">
    <GradientStop Color="#FFE8E9EB" Offset="0" />
    <GradientStop Color="#FFF0F1F2" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="CheckBoxHoverOutterBorderBrush" Color="#FFCF9037" />
  <SolidColorBrush x:Key="CheckBoxHoverOutterBackgroundBrush" Color="#FFFCF1C2" />
  <LinearGradientBrush x:Key="CheckBoxHoverInnerBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFCAD5D" Offset="0" />
    <GradientStop Color="#FFFDCC9B" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="CheckBoxHoverInnerBackgroundBrush" EndPoint="0.859,0.848" StartPoint="0.141,0.152">
    <GradientStop Color="#FFFAECC8" Offset="0" />
    <GradientStop Color="#FFFCF3DD" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="CheckBoxPressedOutterBorderBrush" Color="#FFC26D1D" />
  <SolidColorBrush x:Key="CheckBoxPressedOutterBackgroundBrush" Color="#FFFCE7BD" />
  <LinearGradientBrush x:Key="CheckBoxPressedInnerBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFCA558" Offset="0" />
    <GradientStop Color="#FFFDCB9F" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="CheckBoxPressedInnerBackgroundBrush" EndPoint="0.859,0.848" StartPoint="0.141,0.152">
    <GradientStop Color="#FFFAE0A2" Offset="0" />
    <GradientStop Color="#FFFCEDC9" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="GalleryBorderBrush" Color="#FFE2E4E7" />
  <SolidColorBrush x:Key="GalleryHeaderBackgroundBrush" Color="#FF959595" />
  <LinearGradientBrush x:Key="KeyTipBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="White" Offset="0" />
    <GradientStop Color="#FFEAEAF4" Offset="1" />
    <GradientStop Color="#FFF6F6FA" Offset="0.746" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="KeyTipBorderBrush" Color="#FF767676" />
  <SolidColorBrush x:Key="MenuItemCheckBoxBackgroundBrush" Color="#FFFCF1C2" />
  <SolidColorBrush x:Key="MenuItemCheckBoxBorderBrush" Color="#FFF29536" />
  <SolidColorBrush x:Key="ContextMenuBarBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="ContextMenuBarBorderBrush" Color="#FFA7ABB0" />
  <SolidColorBrush x:Key="ContextMenuLineBrush" Color="#FFE2E4E7" />
  <SolidColorBrush x:Key="ContextMenuSeparatorBrush" Color="#FFC7C8C9" />
  <SolidColorBrush x:Key="ScrollViewerButtonBorderBrush" Color="#FF79848C" />
  <LinearGradientBrush x:Key="ScrollViewerButtonBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="White" Offset="0" />
    <GradientStop Color="#FFE8EBEF" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="CaptionButtonCloseHoverOutterBorderBrush" Color="#FF9B3D3D" />
  <LinearGradientBrush x:Key="CaptionButtonCloseHoverInnerBorderBrush">
    <GradientStop Color="#FFFF8482" Offset="0" />
    <GradientStop Color="#FFEF7070" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="CaptionButtonCloseHoverInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFF8483" Offset="0" />
    <GradientStop Color="#FFE36162" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="CaptionButtonClosePressedOutterBorderBrush" Color="#FF9B3D3D" />
  <SolidColorBrush x:Key="CaptionButtonClosePressedInnerBorderBrush" Color="#FFDA6163" />
  <LinearGradientBrush x:Key="CaptionButtonClosePressedInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFEA7070" Offset="0" />
    <GradientStop Color="#FFEA7070" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ScrollWhiteOutterBorderBrush" Color="#FF8A9199" />
  <SolidColorBrush x:Key="ScrollWhiteOutterBackgroundBrush" Color="#FFD9DEE3" />
  <LinearGradientBrush x:Key="ScrollWhiteInnerBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFF0F4F8" Offset="0" />
    <GradientStop Color="#FFD7DBE1" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ScrollWhiteInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFEFF3F7" Offset="0" />
    <GradientStop Color="#FFDADEE4" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ScrollWhiteOverOutterBorderBrush" Color="#FF969EA8" />
  <SolidColorBrush x:Key="ScrollWhiteOverOutterBackgroundBrush" Color="#FFE5E9EB" />
  <LinearGradientBrush x:Key="ScrollWhiteOverInnerBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFFCFDFE" Offset="0" />
    <GradientStop Color="#FFF1F3F5" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ScrollWhiteOverInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFF7FAFC" Offset="0" />
    <GradientStop Color="#FFE4E8EC" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ScrollWhitePressedOutterBorderBrush" Color="#FFAEB3B8" />
  <SolidColorBrush x:Key="ScrollWhitePressedOutterBackgroundBrush" Color="#FFD6D7D9" />
  <LinearGradientBrush x:Key="ScrollWhitePressedInnerBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFE1E2E3" Offset="0" />
    <GradientStop Color="#FFE1E2E3" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ScrollWhitePressedInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFE1E2E3" Offset="0" />
    <GradientStop Color="#FFE1E2E3" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ScrollWhiteBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFE1E2E3" Offset="0" />
    <GradientStop Color="#FFEFEFEF" Offset="0.05" />
    <GradientStop Color="#FFEFEFEF" Offset="0.95" />
    <GradientStop Color="#FFEBEDEF" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ScrollWhiteVerticalOutterBorderBrush" Color="#FF8A9199" />
  <SolidColorBrush x:Key="ScrollWhiteVerticalOutterBackgroundBrush" Color="#FFD9DEE3" />
  <LinearGradientBrush x:Key="ScrollWhiteVerticalInnerBorderBrush" EndPoint="1,0.5" StartPoint="0,0.5">
    <GradientStop Color="#FFF0F4F8" Offset="0" />
    <GradientStop Color="#FFD7DBE1" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ScrollWhiteVerticalInnerBackgroundBrush" EndPoint="1,0.5" StartPoint="0,0.5">
    <GradientStop Color="#FFEFF3F7" Offset="0" />
    <GradientStop Color="#FFDADEE4" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ScrollWhiteVerticalOverOutterBorderBrush" Color="#FF969EA8" />
  <SolidColorBrush x:Key="ScrollWhiteVerticalOverOutterBackgroundBrush" Color="#FFE5E9EB" />
  <LinearGradientBrush x:Key="ScrollWhiteVerticalOverInnerBorderBrush" EndPoint="1,0.5" StartPoint="0,0.5">
    <GradientStop Color="#FFFCFDFE" Offset="0" />
    <GradientStop Color="#FFF1F3F5" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ScrollWhiteVerticalOverInnerBackgroundBrush" EndPoint="1,0.5" StartPoint="0,0.5">
    <GradientStop Color="#FFF7FAFC" Offset="0" />
    <GradientStop Color="#FFE4E8EC" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ScrollWhiteVerticalPressedOutterBorderBrush" Color="#FFAEB3B8" />
  <SolidColorBrush x:Key="ScrollWhiteVerticalPressedOutterBackgroundBrush" Color="#FFD6D7D9" />
  <LinearGradientBrush x:Key="ScrollWhiteVerticalPressedInnerBorderBrush" EndPoint="1,0.5" StartPoint="0,0.5">
    <GradientStop Color="#FFE1E2E3" Offset="0" />
    <GradientStop Color="#FFE1E2E3" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ScrollWhiteVerticalPressedInnerBackgroundBrush" EndPoint="1,0.5" StartPoint="0,0.5">
    <GradientStop Color="#FFE1E2E3" Offset="0" />
    <GradientStop Color="#FFE1E2E3" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ScrollWhiteVerticalBackgroundBrush" EndPoint="1,0.5" StartPoint="0,0.5">
    <GradientStop Color="#FFE1E2E3" Offset="0" />
    <GradientStop Color="#FFEFEFEF" Offset="0.05" />
    <GradientStop Color="#FFEFEFEF" Offset="0.95" />
    <GradientStop Color="#FFEBEDEF" Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="ButtonBackstageOutterBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFDEDFE0" Offset="0" />
    <GradientStop Color="#FFA1A2A4" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ButtonBackstageShadowBrush" Color="#7FA1A2A4" />
  <LinearGradientBrush x:Key="ButtonBackstageInnerBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="White" Offset="0.009" />
    <GradientStop Color="#FFEDEFF1" Offset="1" />
  </LinearGradientBrush>
  <Color x:Key="HighlightDarkColor">#FF086F9E</Color>
  <Color x:Key="HighlightLightColor">#FF086F9E</Color>
  <Color x:Key="AccentColor">#CC119EDA</Color>
  <Color x:Key="AccentColor2">#99119EDA</Color>
  <Color x:Key="AccentColor3">#66119EDA</Color>
  <Color x:Key="AccentColor4">#33119EDA</Color>
  <Color x:Key="BlackColor">#FF000000</Color>
  <Color x:Key="WhiteColor">#FFFFFFFF</Color>
  <Color x:Key="Gray1">#FFCCCCCC</Color>
  <Color x:Key="Gray2">#FF7F7F7F</Color>
  <Color x:Key="Gray3">#FF333333</Color>
  <Color x:Key="Gray4">#FFB9B9B9</Color>
  <Color x:Key="Gray5">#FFD8D8D9</Color>
  <Color x:Key="Gray6">#FF9D9D9D</Color>
  <Color x:Key="Gray7">#FFF7F7F7</Color>
  <Color x:Key="Gray8">#FFE0E0E0</Color>
  <Color x:Key="Gray9">#FFA59F93</Color>
  <Color x:Key="Gray10">#7FFFFFFF</Color>
  <Color x:Key="Gray11">#7FA9A9A9</Color>
  <Color x:Key="Gray12">#A5F7F7F7</Color>
  <Color x:Key="Gray13">#5EC9C9C9</Color>
  <Color x:Key="TextBoxText">#FF414141</Color>
  <Color x:Key="NormalForegroundColor">#FF000000</Color>
  <Color x:Key="HoverForegroundColor">#FFFFFFFF</Color>
  <Color x:Key="BaseColor2">#FFFFFFFF</Color>
  <Color x:Key="BaseColor5">#FFBABABA</Color>
  <Color x:Key="BaseColor3">#FF303030</Color>
  <Color x:Key="TransparentWhiteColor">#00FFFFFF</Color>
  <Color x:Key="SemiTransparentWhiteColor">#55FFFFFF</Color>
  <Color x:Key="TransparentLightLightColor">#A5FFFFFF</Color>
  <Color x:Key="ValidationColor1">#052A2E31</Color>
  <Color x:Key="ValidationColor2">#152A2E31</Color>
  <Color x:Key="ValidationColor3">#252A2E31</Color>
  <Color x:Key="ValidationColor4">#352A2E31</Color>
  <Color x:Key="ValidationColor5">#FFDC000C</Color>
  <Color x:Key="ValidationSummaryColor1">#FFDC020D</Color>
  <Color x:Key="ValidationSummaryColor2">#FFCA000C</Color>
  <Color x:Key="ValidationSummaryColor3">#FFFF9298</Color>
  <Color x:Key="ValidationSummaryColor4">#FFFDC8C8</Color>
  <Color x:Key="ValidationSummaryColor5">#DDD43940</Color>
  <Color x:Key="ValidationSummaryFillColor1">#59F7D8DB</Color>
  <Color x:Key="ValidationSummaryFillColor2">#FFF7D8DB</Color>
  <Color x:Key="ControlsValidationColor">#FFDB000C</Color>
  <Color x:Key="ProgressIndeterminateColor1">#33878787</Color>
  <Color x:Key="ProgressIndeterminateColor2">#33959595</Color>
  <Color x:Key="ProgressIndeterminateColor3">#4C000000</Color>
  <Color x:Key="ProgressIndeterminateColor4">#4C000000</Color>
  <SolidColorBrush x:Key="NavigationBorderBrush" Color="#FF9D9492" />
  <SolidColorBrush x:Key="PageBorderBrush" Color="#FFB2B2B2" />
  <SolidColorBrush x:Key="BodyTextColorBrush" Color="#FF313131" />
  <DropShadowEffect x:Key="DropShadowBrush" Direction="330" Opacity="0.3" ShadowDepth="0" BlurRadius="6" />
  <SolidColorBrush x:Key="SeperatorBrush" Color="#FFC4C4C5" />
  <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
    <GradientStop Color="#F3F3F3" Offset="0" />
    <GradientStop Color="#EBEBEB" Offset="0.5" />
    <GradientStop Color="#DDDDDD" Offset="0.5" />
    <GradientStop Color="#CDCDCD" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070" />
  <ControlTemplate x:Key="ControlFocusEmptyTemplate" TargetType="{x:Type Control}">
    <Rectangle Stroke="#00000000">
      <Rectangle.Fill>
        <SolidColorBrush />
      </Rectangle.Fill>
    </Rectangle>
  </ControlTemplate>
  <Fluent:ObjectToImageConverter x:Key="StringToImageConvert" />
  <Fluent:ApplicationMenuRightContentExtractorConverter x:Key="ApplicationMenuRightContentExtractorConvert" />
  <ControlTemplate x:Key="BackstageToggleButtonControlTemplate" TargetType="{x:Type Fluent:Backstage}">
    <Border x:Name="border2" MinWidth="60" Height="24" Background="{TemplateBinding Background}" Margin="0,0,1,0">
      <Grid>
        <Rectangle x:Name="rectangle" />
        <ContentPresenter x:Name="contentPresenter" ContentSource="Header" Margin="10,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Center" />
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Fill" TargetName="rectangle" Value="#3FFFFFFF" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="border2" Value="0.5" />
        <Setter Property="Effect" TargetName="contentPresenter">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsOpen" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" SourceName="border2" />
          <Condition Property="IsOpen" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="rectangle" Value="Collapsed" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />
  <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter" />
  <ControlTemplate TargetType="{x:Type Fluent:ScreenTip}" x:Key="ScreenTipControlTemplate">
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="5" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="5" />
      </Grid.RowDefinitions>
      <Border Grid.RowSpan="1" BorderThickness="1" BorderBrush="LightGray" Background="White">
        <Grid>
          <StackPanel x:Name="screenTipPanel">
            <TextBlock x:Name="title" TextWrapping="Wrap" Margin="7,8,7,10" FontWeight="Bold" Text="{TemplateBinding Property=Title}" />
            <Grid x:Name="imageAndTextSection">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
              </Grid.ColumnDefinitions>
              <Image Margin="7,5,3,7" HorizontalAlignment="Left" VerticalAlignment="Top" Source="{TemplateBinding Property=Image}" MaxHeight="48" />
              <TextBlock Text="{TemplateBinding Property=Text}" TextWrapping="Wrap" Margin="8,0,8,6" Foreground="#FF414141" Grid.Column="1" />
            </Grid>
            <Border x:Name="separator" Height="2" Width="Auto" HorizontalAlignment="Stretch" Visibility="{Binding ElementName=disableReasonSection, Path=Visibility}" Margin="5" Background="LightGray" BorderThickness="0,0,0,1" IsEnabled="{Binding Path=(IsEnabled), RelativeSource={RelativeSource FindAncestor, AncestorType=Control, AncestorLevel=2}}" />
            <Grid x:Name="disableReasonSection">
              <Image Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,0,0,0" Source="pack://application:,,,/Fluent;component\Themes\Office2010\Images\WarningSmall.png" />
              <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock x:Name="disableReasonHeader" x:Uid="disableReasonHeader" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=ScreenTipDisableReasonHeader, Mode=OneWay}" TextWrapping="Wrap" Margin="28,0,5,2" Foreground="#FF414141" HorizontalAlignment="Stretch" Grid.Row="0" FontWeight="Bold" />
                <TextBlock x:Name="disableReasonText" Text="{TemplateBinding Property=DisableReason}" TextWrapping="Wrap" Margin="28,0,5,6" Foreground="#FF414141" HorizontalAlignment="Stretch" Grid.Row="1" />
                <TextBlock x:Name="helpText" TextWrapping="Wrap" Margin="28,0,5,6" Foreground="#FF414141" Grid.RowSpan="1" Grid.Row="2" HorizontalAlignment="Stretch" Text="{Binding Text, ElementName=textBlock, Mode=Default}" />
              </Grid>
            </Grid>
            <Border x:Name="separator2" Height="2" Width="Auto" HorizontalAlignment="Stretch" Visibility="{TemplateBinding Property=HelpLabelVisibility}" Margin="5" Background="LightGray" BorderThickness="0,0,0,1" />
            <Grid x:Name="helpSection" Visibility="{TemplateBinding Property=HelpLabelVisibility}">
              <Image Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,0,0,0" Source="pack://application:,,,/Fluent;component\Themes\Office2010\Images\HelpSmall.png" />
              <TextBlock x:Uid="HelpText" x:Name="textBlock" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=ScreenTipF1LabelHeader, Mode=OneWay}" TextWrapping="Wrap" Margin="28,0,6,6" Foreground="#FF414141" FontWeight="Bold" HorizontalAlignment="Stretch" />
              <ContentControl x:Name="helpTopic" Content="{TemplateBinding Property=HelpTopic}" Visibility="Collapsed" />
            </Grid>
          </StackPanel>
        </Grid>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" SourceName="separator" Value="False">
        <Setter Property="Visibility" TargetName="disableReasonSection" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" SourceName="separator" Value="True">
        <Setter Property="Visibility" TargetName="disableReasonSection" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Content" SourceName="helpTopic" Value="{x:Null}" />
          <Condition Property="Text" Value="" SourceName="disableReasonText" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="separator" Value="Collapsed" />
      </MultiTrigger>
      <Trigger Property="Text" SourceName="disableReasonText" Value="">
        <Setter Property="Visibility" TargetName="disableReasonSection" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Content" SourceName="helpTopic" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="helpText" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="helpSection" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="separator2" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Visibility" SourceName="disableReasonSection" Value="Visible">
        <Setter Property="Visibility" TargetName="helpText" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="TwoLineLabelControlTemplate" TargetType="{x:Type Fluent:TwoLineLabel}">
    <StackPanel x:Name="stackPanel" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
      <AccessText TextWrapping="Wrap" x:Name="PART_TextRun" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" />
      <StackPanel x:Name="stackPanel1" Margin="0,-2,0,0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
        <AccessText TextWrapping="Wrap" x:Name="PART_TextRun2" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" />
        <Border x:Name="border" Height="Auto" Width="5" HorizontalAlignment="Center" Margin="0">
          <Path x:Name="path" Width="5" Height="3" StrokeThickness="0" Data="M0,0L5,0 2.5,3z" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,0" SnapsToDevicePixels="True" Fill="{TemplateBinding Foreground}" />
        </Border>
      </StackPanel>
    </StackPanel>
    <ControlTemplate.Triggers>
      <Trigger Property="HasTwoLines" Value="False">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="HorizontalAlignment" TargetName="stackPanel" Value="Left" />
        <Setter Property="Margin" TargetName="border" Value="0" />
        <Setter Property="VerticalAlignment" TargetName="stackPanel" Value="Center" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Center" />
        <Setter Property="Margin" TargetName="stackPanel1" Value="3,-2,0,0" />
        <Setter Property="VerticalAlignment" TargetName="stackPanel1" Value="Center" />
      </Trigger>
      <Trigger Property="HasGlyph" Value="False">
        <Setter Property="Visibility" TargetName="path" Value="Collapsed" />
        <Setter Property="Width" TargetName="border" Value="0.1" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <SolidColorBrush x:Key="ButtonCheckedBrush" Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.2" />
  <ControlTemplate TargetType="{x:Type Fluent:CheckBox}" x:Key="CheckBoxControlTemplate">
    <Grid>
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
          <VisualState x:Name="MouseOver">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverRectangle">
                <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="grid">
                <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Pressed">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PressedRectangle">
                <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Disabled">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
                <SplineDoubleKeyFrame KeyTime="0" Value=".55" />
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisabledVisualElement">
                <SplineDoubleKeyFrame KeyTime="0" Value="0.55" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="CheckStates">
          <VisualState x:Name="Checked">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CheckIcon">
                <SplineDoubleKeyFrame KeyTime="0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Unchecked" />
          <VisualState x:Name="Indeterminate">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="IndeterminateIcon">
                <SplineDoubleKeyFrame KeyTime="0" Value="1" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup x:Name="FocusStates">
          <VisualState x:Name="Focused">
            <Storyboard />
          </VisualState>
          <VisualState x:Name="Unfocused" />
        </VisualStateGroup>
        <VisualStateGroup x:Name="ValidationStates">
          <VisualState x:Name="Valid" />
          <VisualState x:Name="InvalidUnfocused">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="InvalidFocused">
            <Storyboard>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
              <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" Storyboard.TargetName="validationTooltip">
                <DiscreteObjectKeyFrame KeyTime="0">
                  <DiscreteObjectKeyFrame.Value>
                    <System:Boolean>True</System:Boolean>
                  </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
              </ObjectAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="16" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid HorizontalAlignment="Left" VerticalAlignment="Center">
        <Grid x:Name="grid" Height="14" Width="14" Opacity="0.7">
          <Rectangle x:Name="Background" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" />
          <Rectangle x:Name="MouseOverRectangle" Stroke="#FF7F7F7F" Opacity="0" />
          <Rectangle x:Name="PressedRectangle" Stroke="Black" Opacity="0" />
          <Path Opacity="0" x:Name="CheckIcon" Data="M49.4375,110.4375 L51.4995,112.812 L56.3745,107.24883" HorizontalAlignment="Center" Height="7.6" Stretch="Fill" Stroke="#FF000000" Fluent:FrameworkHelper.UseLayoutRounding="False" VerticalAlignment="Center" Width="8.9" StrokeStartLineCap="Triangle" StrokeEndLineCap="Triangle" StrokeThickness="2" />
          <Rectangle x:Name="IndeterminateIcon" Height="8" Width="8" Opacity="0">
            <Rectangle.Fill>
              <SolidColorBrush Color="#FF333333" />
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle x:Name="DisabledVisualElement" Fill="White" Opacity="0" RadiusY="1" RadiusX="1" />
        </Grid>
        <Border x:Name="ValidationErrorElement" BorderBrush="#FFDB000C" BorderThickness="1" CornerRadius="1" Margin="1" Visibility="Collapsed">
          <Grid Background="Transparent" HorizontalAlignment="Right" Height="10" Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10">
            <Path Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="#DDD43940" Margin="0,3,0,0" />
            <Path Data="M 0,0 L2,0 L 7,5 L7,7" Fill="White" Margin="0,3,0,0" />
          </Grid>
        </Border>
      </Grid>
      <ContentControl Grid.Column="1" IsTabStop="False">
        <ContentControl.Foreground>
          <SolidColorBrush x:Name="ContentPresenterWrapperColor" Color="Black" />
        </ContentControl.Foreground>
        <ContentPresenter x:Name="contentPresenter" RecognizesAccessKey="True" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Header}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
      </ContentControl>
    </Grid>
  </ControlTemplate>
  <Style x:Key="EmptyCheckBoxFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Margin="1" SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="CheckRadioFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="EmptyRadioButtonFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Margin="1" SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="GalleryGroupContainerTemplate" TargetType="{x:Type Fluent:GalleryGroupContainer}">
    <!--<Border BorderThickness="1" BorderBrush="DarkGray" Margin="1">
      <StackPanel>
        <Border BorderThickness="1" BorderBrush="DarkGray" Margin="1">
          <TextBlock Text="{TemplateBinding Header}" />
        </Border>
        <WrapPanel HorizontalAlignment="Left"
                   IsItemsHost="True" Orientation="{TemplateBinding Orientation}"
                   ItemWidth ="{TemplateBinding ItemWidth}"
                   ItemHeight="{TemplateBinding ItemHeight}"/>
      </StackPanel>
    </Border>-->
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition />
      </Grid.RowDefinitions>
      <Grid Grid.Row="0" Height="21" x:Name="headerGrid" Background="#FFF0F2F5" Grid.ColumnSpan="2" VerticalAlignment="Top">
        <TextBlock Margin="7,0" Text="{TemplateBinding Header}" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
      </Grid>
      <Image Grid.Row="1" Grid.Column="0" Stretch="None" Margin="4,0,4,0" VerticalAlignment="Top" HorizontalAlignment="Center" x:Name="iconImage">
        <!--        <Image.Source>
          <MultiBinding Converter="{StaticResource GroupIconConverter}">
            <Binding Path="Items"/>
            <Binding ElementName="layoutRoot"/>
          </MultiBinding>
        </Image.Source>-->
      </Image>
      <Rectangle Grid.Row="1" Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Right" Width="1" Height="Auto" Visibility="Visible" x:Name="menuLine" Margin="0,0,0,0" />
      <ItemsPresenter Grid.Row="1" Grid.Column="1" Margin="0,0,0,0" />
      <!--<WrapPanel Grid.Column="1" Margin="0,21,0,0"
                   IsItemsHost="True" Orientation="{TemplateBinding Orientation}"
                   ItemWidth ="{TemplateBinding ItemWidth}"
                   ItemHeight="{TemplateBinding ItemHeight}"/>-->
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger SourceName="iconImage" Property="Source" Value="{x:Null}">
        <Setter TargetName="menuLine" Property="Visibility" Value="Collapsed" />
        <Setter TargetName="iconImage" Property="Visibility" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsHeadered" Value="False">
        <Setter TargetName="headerGrid" Property="Visibility" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonContextualTabGroupControlTemplate" TargetType="{x:Type Fluent:RibbonContextualTabGroup}">
    <Border x:Name="rootBorder" Visibility="{TemplateBinding InnerVisibility}" Margin="2,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top" Width="Auto" Height="25" BorderThickness="1,0">
      <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0" Margin="0,0,0,-25" VerticalAlignment="Top" Height="25">
        <Grid Margin="0" VerticalAlignment="Top" Height="25">
          <Rectangle Fill="{TemplateBinding Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto">
            <Rectangle.OpacityMask>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#E5000000" Offset="0" />
                <GradientStop Color="#26000000" Offset="1" />
                <GradientStop Color="#E5000000" Offset="0.16" />
                <GradientStop Color="#26000000" Offset="0.16" />
              </LinearGradientBrush>
            </Rectangle.OpacityMask>
          </Rectangle>
          <TextBlock Text="{TemplateBinding Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0" TextTrimming="CharacterEllipsis" Foreground="{TemplateBinding Background}" />
        </Grid>
      </Border>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsWindowMaximized" Value="True">
        <Setter Property="Margin" TargetName="rootBorder" Value="2,2,0,-0.1" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonTitleBarControlTemplate" TargetType="{x:Type Fluent:RibbonTitleBar}">
    <Grid Height="25">
      <ContentPresenter x:Name="PART_QuickAccessToolbarHolder" ContentSource="QuickAccessToolBar" />
      <ContentPresenter x:Name="PART_HeaderHolder" ContentSource="Header" IsHitTestVisible="False" />
      <Fluent:RibbonContextualGroupsContainer x:Name="PART_ItemsContainer" IsItemsHost="True" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsCollapsed" Value="True">
        <Setter Property="Visibility" Value="Collapsed" TargetName="PART_QuickAccessToolbarHolder" />
        <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ItemsContainer" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="ResizeBothThumbControlTemplate" TargetType="{x:Type Thumb}">
    <Grid Background="#00000000">
      <Rectangle Fill="White" StrokeThickness="0" Width="2" Height="2" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,2,1" />
      <Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,2,5" VerticalAlignment="Bottom" Width="2" Height="2" />
      <Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,6,1" VerticalAlignment="Bottom" Width="2" Height="2" />
      <Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,3,2" VerticalAlignment="Bottom" Width="2" Height="2" />
      <Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,3,6" VerticalAlignment="Bottom" Width="2" Height="2" />
      <Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,7,2" VerticalAlignment="Bottom" Width="2" Height="2" />
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="ResizeVerticalThumbControlTemplate" TargetType="{x:Type Thumb}">
    <Grid Background="#00000000">
      <StackPanel Margin="0,1,0,0" Orientation="Horizontal" d:LayoutOverrides="Height" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
          <Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2" />
          <Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2" />
        </Grid>
        <Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
          <Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2" />
          <Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2" />
        </Grid>
        <Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
          <Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2" />
          <Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2" />
        </Grid>
        <Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
          <Rectangle Fill="White" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2" />
          <Rectangle Fill="#FFB5BEC7" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2" />
        </Grid>
      </StackPanel>
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="MenuGroupSeparatorControlTemplate" TargetType="{x:Type Fluent:GroupSeparatorMenuItem}">
    <Grid Height="21" Background="#FFF0F2F5">
      <TextBlock Margin="7,0" Text="{TemplateBinding Header}" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" />
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="BackstageTabItemControlTemplate" TargetType="{x:Type Fluent:BackstageTabItem}">
    <Grid Background="#00000000">
      <Border x:Name="hoverBorder" Margin="0,0,0,0" Visibility="Collapsed">
        <Border.Background>
          <SolidColorBrush Color="Black" Opacity="0.2" />
        </Border.Background>
      </Border>
      <Border x:Name="selectedBorder" Margin="0" Visibility="Collapsed">
        <Border.Background>
          <SolidColorBrush Color="White" Opacity="0.2" />
        </Border.Background>
        <Grid Width="Auto" Margin="0" HorizontalAlignment="Stretch" />
      </Border>
      <ContentControl x:Name="PART_Header" Margin="25,0,15,0" HorizontalAlignment="Left" VerticalAlignment="Center" Content="{TemplateBinding Header}">
        <ContentControl.Resources>
          <Style TargetType="TextBlock">
            <Setter Property="TextWrapping" Value="NoWrap" />
            <Setter Property="TextTrimming" Value="CharacterEllipsis" />
          </Style>
        </ContentControl.Resources>
      </ContentControl>
    </Grid>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="Selector.IsSelected" Value="False" />
        </MultiTrigger.Conditions>
        <Setter TargetName="hoverBorder" Property="Visibility" Value="Visible" />
        <Setter TargetName="selectedBorder" Property="Visibility" Value="Collapsed" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter TargetName="hoverBorder" Property="Visibility" Value="Hidden" />
        <Setter TargetName="PART_Header" Property="Opacity" Value="0.5" />
      </Trigger>
      <Trigger Property="Selector.IsSelected" Value="True">
        <Setter TargetName="selectedBorder" Property="Visibility" Value="Visible" />
        <Setter TargetName="PART_Header" Property="Foreground" Value="White" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:SeparatorTabItem}" x:Key="InnerBackstageSeparatorTabItemStyle">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:SeparatorTabItem}">
          <Grid Margin="0,0,10,0">
            <TextBlock Margin="0,5" TextWrapping="Wrap" Text="{TemplateBinding Header}" VerticalAlignment="Center" FontSize="17" FontFamily="Segoe UI Light, Lucida Sans Unicode, Verdana">
              <TextBlock.Foreground>
                <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" />
              </TextBlock.Foreground>
            </TextBlock>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="BackstageButtonControlTemplate" TargetType="{x:Type Fluent:Button}">
    <Grid Background="#00000000">
      <Border x:Name="border" BorderBrush="{x:Null}" BorderThickness="0" CornerRadius="1" Visibility="Collapsed" Background="{TemplateBinding Background}">
        <Border Margin="0" CornerRadius="1" BorderThickness="1" BorderBrush="#19000000" Background="#BFFFFFFF">
          <Border BorderBrush="#7FFFFFFF" BorderThickness="1" CornerRadius="1" Background="#33FFFFFF" />
        </Border>
      </Border>
      <StackPanel Orientation="Horizontal" Margin="16,0,15,0" HorizontalAlignment="Left" VerticalAlignment="Center">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Left" Height="16" VerticalAlignment="Center" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="16" SnapsToDevicePixels="True" />
        <TextBlock Text="{TemplateBinding Header}" TextWrapping="NoWrap" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0" TextTrimming="CharacterEllipsis" x:Name="controlLabel" />
      </StackPanel>
    </Grid>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="{x:Type StatusBar}" TargetType="{x:Type StatusBar}">
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type StatusBar}">
          <Border BorderThickness="0,1">
            <Border Height="Auto" BorderThickness="0,1" Background="{Binding RibbonThemeColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}">
              <ItemsPresenter Height="Auto" />
            </Border>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="{x:Type StatusBarItem}" TargetType="{x:Type StatusBarItem}">
    <Setter Property="Padding" Value="3,0,3,0" />
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type StatusBarItem}">
          <ContentPresenter Margin="{TemplateBinding Padding}" />
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Foreground" Value="#FF888888" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="Transparent" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <SolidColorBrush x:Key="ScrollThumbDefaultBorderBrush" Color="#FFABABAB" />
  <SolidColorBrush x:Key="ScrollThumbDefaultBackgroundBrush" Color="White" />
  <SolidColorBrush x:Key="ScrollThumbHoverBorderBrush" Color="#FFABABAB" />
  <SolidColorBrush x:Key="ScrollThumbHoverBackgroundBrush" Color="#FFF0F0F0" />
  <SolidColorBrush x:Key="ScrollThumbPressedBorderBrush" Color="#FF777777" />
  <SolidColorBrush x:Key="ScrollThumbPressedBackgroundBrush" Color="#FFF0F0F0" />
  <ControlTemplate x:Key="TextBoxControlTemplate" TargetType="{x:Type Fluent:TextBox}">
    <Border Name="Border" CornerRadius="0" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <ScrollViewer Margin="0" x:Name="PART_ContentHost" />
    </Border>
  </ControlTemplate>
  <Fluent:ColorGradientItemTemplateSelector x:Key="ColorGradientItemTemplateSelect" />
  <Style x:Key="SeparatorTabItemStyle" TargetType="Fluent:SeparatorTabItem">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Fluent:SeparatorTabItem">
          <ContentPresenter ContentSource="Header" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="{x:Type Fluent:StatusBar}" TargetType="{x:Type Fluent:StatusBar}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Height" Value="23" />
    <Setter Property="Margin" Value="0,0,0,-1" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:StatusBar}">
          <Border Height="Auto" BorderThickness="0,1" Background="{Binding RibbonThemeColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}">
            <Fluent:StatusBarPanel IsItemsHost="True" x:Name="itemsPresenter" Height="Auto" Margin="0" />
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsWindowMaximized" Value="False">
              <Setter Property="Margin" TargetName="itemsPresenter" Value="0,0,16,0" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="RibbonStatusBarItemStyle" TargetType="{x:Type Fluent:StatusBarItem}">
    <Setter Property="Padding" Value="3,0,3,0" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:StatusBarItem}">
          <ContentPresenter Margin="{TemplateBinding Padding}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Foreground" Value="#FF888888" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="true" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="Transparent" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate TargetType="{x:Type Thumb}" x:Key="SliderThumbControlTemplate">
    <Grid Margin="2.5,0.5">
      <!--<Path x:Name="path1" Data="M0,0L9,0 9,9 4.5,13 0,9z" Fill="{DynamicResource RoundButtonBackgroundBrush}" Margin="0" StrokeStartLineCap="Flat" Stretch="Fill" StrokeEndLineCap="Flat" Stroke="{DynamicResource RoundButtonBorderBrush}" StrokeThickness="1" StrokeMiterLimit="10" StrokeLineJoin="Miter" VerticalAlignment="Center" Width="9" Height="13" HorizontalAlignment="Center"/>
            <Path x:Name="path" Data="M0,0L9,0 9,9 4.5,13 0,9z" Fill="{DynamicResource RoundButtonBackgroundBrush}" Margin="0" StrokeStartLineCap="Flat" Stretch="Fill" StrokeEndLineCap="Flat" Stroke="{DynamicResource RoundButtonBorderBrush}" StrokeThickness="1" StrokeMiterLimit="10" StrokeLineJoin="Miter" VerticalAlignment="Center" Width="7" Height="11" HorizontalAlignment="Center"/>-->
      <Border Name="path" Background="White" Width="3" Height="11">
        <Border Name="hoverborder" />
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsDragging" Value="True">
        <Setter Property="Background" TargetName="hoverborder">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.5" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsDragging" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="hoverborder">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.5" />
          </Setter.Value>
        </Setter>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="SliderRepeatButtonControlTemplate" TargetType="{x:Type RepeatButton}">
    <Grid>
      <ContentPresenter Margin="0" Width="14" Height="14" HorizontalAlignment="Center" VerticalAlignment="Center" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsPressed" Value="True">
        <!--<Setter Property="Fill" TargetName="path" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
        <Setter Property="Stroke" TargetName="path" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>-->
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <!--<Setter Property="Fill" TargetName="path" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
        <Setter Property="Stroke" TargetName="path" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>-->
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
  <conv:ToUpperConverter x:Key="ToUpperConverter" />
  <ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Fluent:MetroWindow}">
    <Grid Background="{TemplateBinding Background}" x:Name="root">
      <Border BorderBrush="{TemplateBinding RibbonThemeColor}" BorderThickness="1" x:Name="themecolorborder" />
      <AdornerDecorator Margin="0" x:Name="content">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
          </Grid.RowDefinitions>
          <Grid x:Name="PART_TitleBar" Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Visibility="{TemplateBinding ShowTitleBar, Converter={StaticResource BooleanToVisibilityConverter}}">
            <Grid.Background>
              <SolidColorBrush Color="Transparent" />
            </Grid.Background>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="auto" />
              <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Image Height="16" Width="16" Margin="2,-2,0,0" Visibility="{TemplateBinding ShowIconOnTitleBar, Converter={StaticResource BooleanToVisibilityConverter}}" Source="{TemplateBinding Icon}" Stretch="UniformToFill" />
          </Grid>
          <ContentPresenter Content="{Binding WindowCommands, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" x:Name="PART_WindowCommands" Panel.ZIndex="1" Grid.RowSpan="2" VerticalAlignment="Top" HorizontalAlignment="Right" Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" />
          <ContentPresenter Grid.Row="1" />
        </Grid>
      </AdornerDecorator>
      <ResizeGrip x:Name="WindowResizeGrip" HorizontalAlignment="Right" IsTabStop="false" Visibility="Collapsed" VerticalAlignment="Bottom" />
      <!--<ItemsControl ItemsSource="{Binding Flyouts, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" VerticalAlignment="Stretch">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid  />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>-->
    </Grid>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="ResizeMode" Value="CanResizeWithGrip" />
          <Condition Property="WindowState" Value="Normal" />
        </MultiTrigger.Conditions>
        <Setter Property="Margin" TargetName="root" Value="0" />
        <Setter Property="Margin" TargetName="content" Value="1" />
        <Setter Property="Visibility" TargetName="themecolorborder" Value="Visible" />
        <Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="WindowState" Value="Maximized">
        <Setter Property="Margin" TargetName="root" Value="0,-2,0,0" />
        <Setter Property="Margin" TargetName="content" Value="0" />
        <Setter Property="Visibility" TargetName="themecolorborder" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate TargetType="{x:Type Button}" x:Key="WindowCommandsControlTemplate">
    <Grid Background="{TemplateBinding Background}">
      <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" Opacity="0.75" Margin="11,1,11,1" />
      <Rectangle x:Name="border" SnapsToDevicePixels="True" IsHitTestVisible="False" Opacity="0.25" Width="0" Height="15" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="{TemplateBinding Foreground}" Margin="10,0,0,0" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter TargetName="contentPresenter" Property="Opacity" Value="1" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="False">
        <Setter TargetName="contentPresenter" Property="Opacity" Value=".5" />
      </Trigger>
      <Trigger Property="IsKeyboardFocused" Value="true" />
      <Trigger Property="ToggleButton.IsChecked" Value="true" />
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="#ADADAD" />
      </Trigger>
      <DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
        <Setter TargetName="border" Property="Rectangle.Width" Value="1" />
      </DataTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <SolidColorBrush x:Key="ControlBackgroundBrush" Color="{StaticResource WhiteColor}" />
  <SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource WhiteColor}" />
  <SolidColorBrush x:Key="BlackBrush" Color="{StaticResource BlackColor}" />
  <SolidColorBrush x:Key="TextBrush" Color="{StaticResource BlackColor}" />
  <SolidColorBrush x:Key="LabelTextBrush" Color="{StaticResource BlackColor}" />
  <SolidColorBrush x:Key="WhiteColorBrush" Color="{StaticResource WhiteColor}" />
  <SolidColorBrush x:Key="BlackColorBrush" Color="{StaticResource BlackColor}" />
  <SolidColorBrush x:Key="HighlightBrush" Color="{StaticResource HighlightDarkColor}" />
  <SolidColorBrush x:Key="HighlightLightBrush" Color="{StaticResource HighlightLightColor}" />
  <SolidColorBrush x:Key="NavigationForegroundBrush" Color="{StaticResource BlackColor}" />
  <SolidColorBrush x:Key="ControlsDisabledBrush" Color="{StaticResource TransparentLightLightColor}" />
  <SolidColorBrush x:Key="DisabledWhiteColorBrush" Color="{StaticResource WhiteColor}" />
  <SolidColorBrush x:Key="TransparentWhiteBrush" Color="{StaticResource TransparentWhiteColor}" />
  <SolidColorBrush x:Key="SemiTransparentWhiteBrush" Color="{StaticResource SemiTransparentWhiteColor}" />
  <SolidColorBrush x:Key="GrayBrush1" Color="{StaticResource Gray1}" />
  <SolidColorBrush x:Key="GrayBrush2" Color="{StaticResource Gray2}" />
  <SolidColorBrush x:Key="GrayBrush3" Color="{StaticResource Gray3}" />
  <SolidColorBrush x:Key="GrayBrush4" Color="{StaticResource Gray4}" />
  <SolidColorBrush x:Key="GrayBrush5" Color="{StaticResource Gray5}" />
  <SolidColorBrush x:Key="GrayBrush6" Color="{StaticResource Gray6}" />
  <SolidColorBrush x:Key="GrayBrush7" Color="{StaticResource Gray7}" />
  <SolidColorBrush x:Key="GrayBrush8" Color="{StaticResource Gray8}" />
  <SolidColorBrush x:Key="GrayBrush9" Color="{StaticResource Gray9}" />
  <SolidColorBrush x:Key="GrayBrush10" Color="{StaticResource Gray10}" />
  <SolidColorBrush x:Key="GrayBrush11" Color="{StaticResource Gray11}" />
  <SolidColorBrush x:Key="GrayBrush12" Color="{StaticResource Gray12}" />
  <SolidColorBrush x:Key="GrayBrush13" Color="{StaticResource Gray13}" />
  <SolidColorBrush x:Key="HoverHyperlinkForegroundBrush" Color="{StaticResource BlackColor}" />
  <SolidColorBrush x:Key="HoverHyperlinkBackgroundBrush" Color="{StaticResource WhiteColor}" />
  <SolidColorBrush x:Key="ControlBorderBrush" Color="{StaticResource Gray1}" />
  <SolidColorBrush x:Key="TextBoxMouseOverBorderBrush" Color="{StaticResource BlackColor}" />
  <SolidColorBrush x:Key="TextBoxMouseOverInnerBorderBrush" Color="{StaticResource BlackColor}" />
  <SolidColorBrush x:Key="CheckBoxBrush" Color="{StaticResource Gray2}" />
  <SolidColorBrush x:Key="CheckBoxMouseOverBrush" Color="{StaticResource Gray3}" />
  <LinearGradientBrush x:Key="CheckBoxBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="{StaticResource Gray5}" Offset="0" />
    <GradientStop Color="{StaticResource WhiteColor}" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="MenuItemDisabledBrush" Color="{StaticResource Gray6}" />
  <SolidColorBrush x:Key="ThumbBrush" Color="{StaticResource Gray4}" />
  <SolidColorBrush x:Key="ItemSelectedBrush" Color="{StaticResource Gray5}" />
  <SolidColorBrush x:Key="SliderTrackBrush" Color="{StaticResource Gray6}" />
  <SolidColorBrush x:Key="ComboBoxPopupBrush" Color="{StaticResource Gray9}" />
  <LinearGradientBrush x:Key="BrandingBrush" EndPoint="0.001,0.5" StartPoint="1.002,0.5">
    <GradientStop Color="{StaticResource HighlightDarkColor}" Offset="0" />
    <GradientStop Color="#FF5FC316" Offset="1" />
  </LinearGradientBrush>
  <SolidColorBrush x:Key="ControlsValidationBrush" Color="{StaticResource ControlsValidationColor}" />
  <SolidColorBrush x:Key="ValidationBrush1" Color="{StaticResource ValidationColor1}" />
  <SolidColorBrush x:Key="ValidationBrush2" Color="{StaticResource ValidationColor2}" />
  <SolidColorBrush x:Key="ValidationBrush3" Color="{StaticResource ValidationColor3}" />
  <SolidColorBrush x:Key="ValidationBrush4" Color="{StaticResource ValidationColor4}" />
  <SolidColorBrush x:Key="ValidationBrush5" Color="{StaticResource ValidationColor5}" />
  <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="{StaticResource WhiteColor}" />
  <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="{StaticResource BlackColor}" />
  <Style x:Key="ControlStyleEmptyFocus" TargetType="{x:Type Control}">
    <Setter Property="Template" Value="{StaticResource ControlFocusEmptyTemplate}" />
  </Style>
  <Style x:Key="RibbonBackstageStyle" TargetType="{x:Type Fluent:Backstage}">
    <Setter Property="Template" Value="{StaticResource BackstageToggleButtonControlTemplate}" />
    <Setter Property="Background" Value="{Binding RibbonThemeColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Foreground" Value="White" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Fluent:FrameworkHelper.UseLayoutRounding" Value="True" />
  </Style>
  <Style TargetType="{x:Type Fluent:Backstage}" BasedOn="{StaticResource RibbonBackstageStyle}" />
  <ControlTemplate TargetType="{x:Type Fluent:RibbonTabItem}" x:Key="RibbonTabItemControlTemplate">
    <Grid x:Name="grid" Background="#00000000" Height="24" VerticalAlignment="Top" Margin="0,7,0,0">
      <Border x:Name="border3" Margin="2,0,0,1" Grid.ColumnSpan="2">
        <Border x:Name="border5" Background="{Binding Group.Background, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="0,0,0,0" Margin="0,0,0,0">
          <Border.OpacityMask>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#26000000" Offset="0" />
              <GradientStop Color="#26000000" Offset="1" />
            </LinearGradientBrush>
          </Border.OpacityMask>
        </Border>
      </Border>
      <Grid x:Name="selectedGrid" Visibility="Collapsed" Margin="2,0,0,0" Grid.ColumnSpan="1">
        <Rectangle x:Name="rectangle" Fill="{StaticResource ActiveTabBackgroundBrush}" StrokeThickness="0" Margin="0" VerticalAlignment="Bottom" Height="1" />
        <Rectangle x:Name="rectangle1" Fill="{StaticResource ActiveTabBackgroundBrush}" StrokeThickness="0" Margin="1.8,0" VerticalAlignment="Bottom" Height="1.2" />
        <Rectangle x:Name="rectangle2" Fill="{StaticResource ActiveTabBackgroundBrush}" StrokeThickness="0" Margin="2,0" VerticalAlignment="Bottom" Height="2" />
        <Border x:Name="border" Margin="1,0,1,2" BorderBrush="{StaticResource RibbonTopBorderBrush}" BorderThickness="1,1,1,0" VerticalAlignment="Stretch" Background="{StaticResource ActiveTabBackgroundBrush}">
          <Border x:Name="border_Copy3" Margin="0" BorderThickness="1,1,1,0" VerticalAlignment="Stretch" CornerRadius="2,2,0,0" BorderBrush="{StaticResource ActiveTabBackgroundBrush}" />
        </Border>
        <!--<Border x:Name="border1" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Bottom" Width="2" Height="2"
                                    BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,1,1"/>-->
        <Border x:Name="border1" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Bottom" Width="2" Height="2" BorderBrush="{StaticResource RibbonTopBorderBrush}" BorderThickness="0,0,1,1" />
        <Border x:Name="border2" HorizontalAlignment="Right" Margin="0" VerticalAlignment="Bottom" Width="2" Height="2" BorderBrush="{StaticResource RibbonTopBorderBrush}" BorderThickness="1,0,0,1" />
      </Grid>
      <Grid x:Name="focusedGrid" Margin="2,0,0,0" Visibility="Collapsed" Grid.ColumnSpan="1">
        <Grid.OpacityMask>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="White" Offset="0" />
            <GradientStop Offset="1" Color="#19FFFFFF" />
          </LinearGradientBrush>
        </Grid.OpacityMask>
        <Border x:Name="border_Copy5" Margin="1,0,1,1" BorderThickness="1,1,1,0" VerticalAlignment="Stretch" CornerRadius="2,2,0,0" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}">
          <Border x:Name="border_Copy6" Margin="0" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1,1,1,0" VerticalAlignment="Stretch" CornerRadius="2,2,0,0" Background="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        </Border>
      </Grid>
      <Border x:Name="PART_ContentContainer" HorizontalAlignment="Stretch" Margin="6,2,4,0" VerticalAlignment="Stretch" Padding="15,0,0,0" Grid.ColumnSpan="1">
        <!--<ContentPresenter x:Name="contentPresenter" ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center" Height="Auto"/>-->
        <Label x:Name="contentPresenter" AutomationProperties.Name="{TemplateBinding Header}" AutomationProperties.AutomationId="{TemplateBinding Name}" Content="{TemplateBinding Header}" Margin="0, -4, 0,-1" HorizontalAlignment="Center" VerticalAlignment="Center" Height="Auto" />
      </Border>
      <Grid x:Name="separatorGrid" Margin="0" Visibility="Collapsed" HorizontalAlignment="Right" Width="2" Grid.Column="1">
        <Rectangle x:Name="separatorRectangle1" Fill="{StaticResource RibbonTopBorderBrush}" Stroke="{StaticResource RibbonTopBorderBrush}" Margin="0,0,1,0" HorizontalAlignment="Right" Width="1" Opacity="1" Visibility="Visible">
          <Rectangle.OpacityMask>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#00000000" Offset="0" />
              <GradientStop Color="#E5FFFFFF" Offset="0.382" />
            </LinearGradientBrush>
          </Rectangle.OpacityMask>
        </Rectangle>
        <Rectangle x:Name="separatorRectangle2" Fill="{StaticResource ActiveTabBackgroundBrush}" Stroke="{StaticResource ActiveTabBackgroundBrush}" HorizontalAlignment="Right" Margin="0" Width="1" Opacity="1" Visibility="Visible">
          <Rectangle.OpacityMask>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#00000000" Offset="0" />
              <GradientStop Color="#BFFFFFFF" Offset="0.329" />
            </LinearGradientBrush>
          </Rectangle.OpacityMask>
        </Rectangle>
      </Grid>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="HasRightGroupBorder" Value="False" />
          <Condition Property="HasLeftGroupBorder" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Margin" TargetName="border5" Value="1,0,-1,0" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="HasLeftGroupBorder" Value="False" />
          <Condition Property="HasRightGroupBorder" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Margin" TargetName="border5" Value="-1,0,1,0" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="HasLeftGroupBorder" Value="False" />
          <Condition Property="HasRightGroupBorder" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Margin" TargetName="border5" Value="-1,0,-1,0" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="HasLeftGroupBorder" Value="True" />
          <Condition Property="HasRightGroupBorder" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Margin" TargetName="border5" Value="1,0,1,0" />
      </MultiTrigger>
      <Trigger Property="Group" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="border3" Value="Collapsed" />
        <Setter Property="Margin" TargetName="separatorGrid" Value="-1,0,0,1" />
        <Setter Property="Visibility" TargetName="border_Copy3" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Selector.IsSelected" Value="True" />
          <Condition Property="IsMinimized" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="selectedGrid" Value="Visible" />
        <Setter Property="Foreground" TargetName="contentPresenter" Value="{Binding Group.Background, RelativeSource={RelativeSource TemplatedParent}}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Selector.IsSelected" Value="True" />
          <Condition Property="IsMinimized" Value="False" />
          <Condition Property="Group" Value="{x:Null}" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="selectedGrid" Value="Visible" />
        <Setter Property="Foreground" TargetName="contentPresenter" Value="{Binding RibbonThemeColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="Selector.IsSelected" Value="False" />
          <Condition Property="IsMinimized" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Foreground" TargetName="contentPresenter" Value="{Binding Group.Background, RelativeSource={RelativeSource TemplatedParent}}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="Selector.IsSelected" Value="False" />
          <Condition Property="IsMinimized" Value="False" />
          <Condition Property="Group" Value="{x:Null}" />
        </MultiTrigger.Conditions>
        <Setter Property="Foreground" TargetName="contentPresenter" Value="{Binding RibbonThemeColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsMinimized" Value="True" />
          <Condition Property="IsOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Foreground" TargetName="contentPresenter" Value="{Binding RibbonThemeColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Selector.IsSelected" Value="True" />
          <Condition Property="IsMinimized" Value="True" />
          <Condition Property="IsOpen" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="grid" Value="#00000000" />
        <Setter Property="Foreground" TargetName="contentPresenter" Value="{Binding Group.Background, RelativeSource={RelativeSource TemplatedParent}}" />
      </MultiTrigger>
      <Trigger Property="IsSeparatorVisible" Value="True">
        <Setter Property="Visibility" TargetName="separatorGrid" Value="Visible" />
        <Setter Property="Margin" TargetName="PART_ContentContainer" Value="6,2,6,0" />
        <Setter Property="Margin" TargetName="selectedGrid" Value="2,0" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonTabItemStyle" TargetType="{x:Type Fluent:RibbonTabItem}">
    <Style.Triggers>
      <Trigger Property="Group" Value="{x:Null}">
        <Setter Property="BorderBrush" Value="{StaticResource RibbonTopBorderBrush}" />
      </Trigger>
      <Trigger Property="Selector.IsSelected" Value="False">
        <Setter Property="Foreground" Value="{StaticResource TabItemFontBrush}" />
      </Trigger>
    </Style.Triggers>
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="Height" Value="31" />
    <Setter Property="IsMinimized" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:RibbonTabControl}}, Path=IsMinimized, Mode=OneWay, FallbackValue=False}" />
    <Setter Property="IsOpen" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:RibbonTabControl}}, Path=IsDropDownOpen, Mode=OneWay, FallbackValue=True}" />
    <Setter Property="Template" Value="{StaticResource RibbonTabItemControlTemplate}" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Indent" Value="12" />
    <Setter Property="Foreground" Value="{StaticResource TabItemSelectedFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Margin" Value="0" />
    <Setter Property="BorderBrush" Value="{StaticResource RibbonTopBorderBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <ControlTemplate x:Key="RibbonTabControlToggleButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="1" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="22" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="22">
      <Border.ToolTip>
        <Fluent:ScreenTip x:Name="screenTip" Title="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=MinimizeButtonScreenTipTitle , Mode=OneWay}" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=MinimizeButtonScreenTipText , Mode=OneWay}" />
      </Border.ToolTip>
      <Border x:Name="border1" Height="Auto" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" Background="{StaticResource TransparentBrush}">
        <Grid>
          <Image x:Name="iconImage" HorizontalAlignment="Center" Height="Auto" Stretch="None" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/RibbonCollapse.png" Width="Auto" Margin="2" />
          <Image x:Name="iconImageChecked" Visibility="Collapsed" HorizontalAlignment="Center" Height="Auto" Stretch="None" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/RibbonExpand.png" Width="Auto" Margin="2" />
        </Grid>
      </Border>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="iconImageChecked" Value="Visible" />
        <Setter Property="Title" TargetName="screenTip" Value="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=ExpandButtonScreenTipTitle , Mode=OneWay}" />
        <Setter Property="Text" TargetName="screenTip" Value="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=ExpandButtonScreenTipText , Mode=OneWay}" />
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonPressedInnerBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonTabControlToggleButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{StaticResource RibbonTabControlToggleButtonControlTemplate}" />
    <Setter Property="Height" Value="22" />
    <Setter Property="Width" Value="22" />
    <!--<Setter Property="QuickAccessElementStyle">
        <Setter.Value>
            <Style TargetType="{x:Type Fluent:ToggleButton}">
                <Setter Property="Template" Value="{StaticResource RibbonTabControlToggleButtonControlTemplate}"/>
                <Setter Property="Height" Value="22"/>
                <Setter Property="Width" Value="22"/>			
                <Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
                <Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
                <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
                <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
            </Style>
        </Setter.Value>
    </Setter>-->
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <Style TargetType="Separator" x:Key="GroupBoxSeparator">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Separator">
          <Border Width="3" Height="55" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,5,2,10" BorderThickness="1,0" BorderBrush="{StaticResource GroupBoxSeparatorBorderBrush}" Background="{StaticResource GroupBoxSeparatorBackgroundBrush}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="DialogLauncherButtonControlTemplate" TargetType="{x:Type Fluent:Button}">
    <Border x:Name="border" BorderThickness="1" CornerRadius="1,0,0,0" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}">
      <Border x:Name="border1" Width="Auto" Height="Auto" BorderThickness="1" CornerRadius="1,0,0,0" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}">
        <Image x:Name="image" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Source="pack://application:,,,/Fluent;Component\Themes\Office2010\Images\DialogLauncher.png" SnapsToDevicePixels="True" Stretch="None" RenderTransformOrigin="0.5,0.5">
          <Image.RenderTransform>
            <TransformGroup>
              <ScaleTransform />
              <SkewTransform />
              <RotateTransform />
              <TranslateTransform />
            </TransformGroup>
          </Image.RenderTransform>
        </Image>
      </Border>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="FlowDirection" Value="RightToLeft">
        <Setter Property="RenderTransform" TargetName="image">
          <Setter.Value>
            <TransformGroup>
              <ScaleTransform ScaleX="-1" />
              <SkewTransform />
              <RotateTransform />
              <TranslateTransform />
            </TransformGroup>
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonPressedInnerBackgroundBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ToolTipStyle" TargetType="{x:Type ToolTip}">
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToolTip}">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="5" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="5" />
            </Grid.RowDefinitions>
            <Border Grid.RowSpan="1" BorderThickness="1" BorderBrush="LightGray" Background="White">
              <ContentPresenter Margin="4,4,4,4" />
            </Border>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScreenTipStyle" TargetType="{x:Type Fluent:ScreenTip}">
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Template" Value="{StaticResource ScreenTipControlTemplate}" />
  </Style>
  <Style x:Key="TwoLineLabelStyle" TargetType="{x:Type Fluent:TwoLineLabel}">
    <Setter Property="Template" Value="{StaticResource TwoLineLabelControlTemplate}" />
  </Style>
  <ControlTemplate x:Key="RibbonButtonControlTemplate" TargetType="{x:Type Fluent:Button}">
    <Border x:Name="border" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Stretch">
      <Grid Height="Auto">
        <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Vertical" d:LayoutOverrides="Width, Height">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" Margin="3,2,3,1" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" Style="{StaticResource TwoLineLabelStyle}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2,-1,2,0" />
        </StackPanel>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Visibility" TargetName="controlLabel" Value="Collapsed" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-1,2,1" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-1,2,1" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonButtonStyle" TargetType="{x:Type Fluent:Button}">
    <Setter Property="Template" Value="{StaticResource RibbonButtonControlTemplate}" />
    <Setter Property="Height" Value="66" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="SnapsToDevicePixels" Value="False" />
    <Style.Triggers>
      <Trigger Property="Fluent:RibbonControl.Size" Value="Large">
        <Setter Property="Height" Value="66" />
      </Trigger>
      <Trigger Property="Fluent:RibbonControl.Size" Value="Middle">
        <Setter Property="Height" Value="22" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
      <Trigger Property="Fluent:RibbonControl.Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="22" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style TargetType="{x:Type Fluent:Button}" BasedOn="{StaticResource RibbonButtonStyle}" />
  <Style x:Key="IronicallyNamedChromelessButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Background" Value="{StaticResource TransparentWhiteBrush}" />
    <Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Padding" Value="1" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid x:Name="grid" Background="{TemplateBinding Background}">
            <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" Opacity="0.75" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="contentPresenter" Property="Opacity" Value="1" />
              <Setter TargetName="grid" Property="Background" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="False">
              <Setter TargetName="contentPresenter" Property="Opacity" Value=".5" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="grid" Property="Background" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Foreground" Value="#ADADAD" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="RibbonToggleButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="1" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Stretch">
      <Grid Height="Auto">
        <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Vertical" d:LayoutOverrides="Width, Height">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" Margin="2" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" Style="{StaticResource TwoLineLabelStyle}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,-3,2,1" />
        </StackPanel>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Fluent:RibbonControl.Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Visibility" TargetName="controlLabel" Value="Collapsed" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Path=Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-2,2,2" />
      </Trigger>
      <Trigger Property="Fluent:RibbonControl.Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,2,2,2" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Path=Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonCheckedBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonCheckedBrush}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="InnerButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="1" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SnapsToDevicePixels="False">
      <Grid Height="Auto">
        <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed" />
        <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Vertical" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" SnapsToDevicePixels="True">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{TemplateBinding LargeIcon}" Width="32" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" Style="{StaticResource TwoLineLabelStyle}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2,-1,2,2" Visibility="Collapsed" />
        </StackPanel>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Visibility" TargetName="controlLabel" Value="Collapsed" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-1,2,1" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-1,-1,1" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter Property="Visibility" TargetName="controlLabel" Value="Visible" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonCheckBoxStyle" TargetType="{x:Type Fluent:CheckBox}">
    <Setter Property="ToolTipService.ShowDuration" Value="30000" />
    <Setter Property="Template" Value="{StaticResource CheckBoxControlTemplate}" />
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="{StaticResource Gray5}" Offset="0" />
          <GradientStop Color="{StaticResource WhiteColor}" Offset="1" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="Foreground" Value="Black" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="BorderBrush" Value="#FF7F7F7F" />
  </Style>
  <Style TargetType="{x:Type Fluent:CheckBox}" BasedOn="{StaticResource RibbonCheckBoxStyle}" />
  <Style x:Key="{x:Type Fluent:RadioButton}" TargetType="{x:Type Fluent:RadioButton}">
    <Setter Property="ToolTipService.ShowDuration" Value="30000" />
    <Setter Property="FocusVisualStyle">
      <Setter.Value>
        <Style>
          <Setter Property="Control.Template">
            <Setter.Value>
              <ControlTemplate>
                <Rectangle Margin="1" SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" />
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:RadioButton}">
          <BulletDecorator SnapsToDevicePixels="true" Background="Transparent" x:Name="bulletDecorator" Height="22">
            <BulletDecorator.Bullet>
              <Grid Width="12" Height="12" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4,4,0,0">
                <Ellipse x:Name="rectangle" Fill="{StaticResource CheckBoxOutterBackgroundBrush}" Stroke="{StaticResource CheckBoxOutterBorderBrush}" />
                <Ellipse x:Name="rectangle1" Margin="1,1,1,1" Fill="{x:Null}" Stroke="{StaticResource CheckBoxOutterBackgroundBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                <Ellipse Margin="2,2,2,2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="defaultRect" Opacity="1" Stroke="{StaticResource CheckBoxInnerBorderBrush}" Fill="{StaticResource CheckBoxInnerBackgroundBrush}" />
                <Ellipse x:Name="rectangle2" StrokeThickness="0" Margin="2" Opacity="0">
                  <Ellipse.Fill>
                    <RadialGradientBrush Center="0.496,1.004" GradientOrigin="0.496,1.004">
                      <GradientStop Color="White" />
                      <GradientStop Offset="1" />
                    </RadialGradientBrush>
                  </Ellipse.Fill>
                </Ellipse>
                <Ellipse Margin="3" VerticalAlignment="Stretch" Stretch="Fill" Stroke="#FF6E7071" StrokeEndLineCap="Triangle" StrokeDashCap="Square" StrokeThickness="1" StrokeStartLineCap="Triangle" x:Name="path">
                  <Ellipse.Fill>
                    <RadialGradientBrush Center="0.367,0.339" GradientOrigin="0.367,0.339">
                      <GradientStop Color="White" Offset="0" />
                      <GradientStop Color="#FF7E8183" Offset="1" />
                    </RadialGradientBrush>
                  </Ellipse.Fill>
                  <Ellipse.BitmapEffect>
                    <OuterGlowBitmapEffect GlowColor="#BFFFFFFF" GlowSize="1" Opacity="1" />
                  </Ellipse.BitmapEffect>
                </Ellipse>
              </Grid>
            </BulletDecorator.Bullet>
            <TextBlock Text="{TemplateBinding Header}" Margin="8,3,4,0" />
          </BulletDecorator>
          <ControlTemplate.Triggers>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="Stroke" TargetName="rectangle" Value="{StaticResource CheckBoxHoverOutterBorderBrush}" />
              <Setter Property="Stroke" TargetName="rectangle1" Value="{StaticResource CheckBoxHoverOutterBackgroundBrush}" />
              <Setter Property="Stroke" TargetName="defaultRect" Value="{StaticResource CheckBoxHoverInnerBorderBrush}" />
              <Setter Property="Fill" TargetName="defaultRect" Value="{StaticResource CheckBoxHoverInnerBackgroundBrush}" />
              <Setter Property="Opacity" TargetName="rectangle2" Value="0.25" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="Stroke" TargetName="rectangle" Value="{StaticResource CheckBoxPressedOutterBorderBrush}" />
              <Setter Property="Fill" TargetName="rectangle" Value="{StaticResource CheckBoxPressedOutterBackgroundBrush}" />
              <Setter Property="Stroke" TargetName="rectangle1" Value="{StaticResource CheckBoxPressedOutterBackgroundBrush}" />
              <Setter Property="Stroke" TargetName="defaultRect" Value="{StaticResource CheckBoxPressedInnerBorderBrush}" />
              <Setter Property="Fill" TargetName="defaultRect" Value="{StaticResource CheckBoxPressedInnerBackgroundBrush}" />
              <Setter Property="Stroke" TargetName="path" Value="Black" />
              <Setter Property="Opacity" TargetName="rectangle2" Value="0.5" />
            </Trigger>
            <Trigger Property="IsChecked" Value="False">
              <Setter Property="Visibility" TargetName="path" Value="Hidden" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" TargetName="bulletDecorator" Value="0.3" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Foreground" Value="#FF464646" />
  </Style>
  <Style x:Key="GalleryGroupContainerStyle" TargetType="{x:Type Fluent:GalleryGroupContainer}">
    <Setter Property="Template" Value="{StaticResource GalleryGroupContainerTemplate}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <WrapPanel HorizontalAlignment="Left" IsItemsHost="True" Orientation="{Binding Orientation, RelativeSource={RelativeSource Self}}" ItemWidth="{Binding ItemWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:GalleryGroupContainer}}}" ItemHeight="{Binding ItemHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:GalleryGroupContainer}}}" />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <StackPanel IsItemsHost="True" Orientation="{Binding Orientation, RelativeSource={RelativeSource Self}}" />
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="ScrollButtonControlTemplate" TargetType="{x:Type RepeatButton}">
    <Border x:Name="border" BorderThickness="1" CornerRadius="2" BorderBrush="{StaticResource ScrollViewerButtonBorderBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource ScrollViewerButtonBackgroundBrush}">
      <Border x:Name="border1" Height="Auto" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Background="{StaticResource TransparentBrush}">
        <Grid Height="Auto">
          <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
                <GradientStop Color="#7FFFFFFF" Offset="0" />
                <GradientStop Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
        </Grid>
      </Border>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="False" />
      <!--<Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
        <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
        <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
        <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
      </Trigger>-->
      <Trigger Property="IsEnabled" Value="False" />
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ScrollButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="Template" Value="{StaticResource ScrollButtonControlTemplate}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <Style x:Key="RibbonScrollViewer" TargetType="{x:Type ScrollViewer}">
    <Setter Property="FocusManager.IsFocusScope" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
          <Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">
            <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
            <RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Left" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M0,0L1,1 1,-1z" />
            </RepeatButton>
            <RepeatButton Command="{x:Static ScrollBar.LineRightCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Right" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M1,0L0,1 0,-1z" />
            </RepeatButton>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="CanContentScroll" Value="True" />
    <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <Style x:Key="RibbonTabScrollViewer" TargetType="{x:Type ScrollViewer}">
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="FocusManager.IsFocusScope" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
          <Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">
            <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
            <RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Left" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}" Margin="0,7,0,1">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M0,0L1,1 1,-1z" />
            </RepeatButton>
            <RepeatButton Command="{x:Static ScrollBar.LineRightCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Right" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}" Margin="0,7,0,1">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M1,0L0,1 0,-1z" />
            </RepeatButton>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="CanContentScroll" Value="True" />
    <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <ControlTemplate TargetType="{x:Type ScrollViewer}" x:Key="MenuScrollViewerControlTemplate">
    <Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">
      <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
      <RepeatButton ClickMode="Hover" Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Stretch" Width="Auto" Height="12" VerticalAlignment="Top" Style="{StaticResource ScrollButtonStyle}">
        <RepeatButton.Visibility>
          <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedVerticalScrollBarVisibility" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalOffset" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentHeight" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportHeight" />
          </MultiBinding>
        </RepeatButton.Visibility>
        <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="5" Height="3" Data="M0,0L1,-1 2,0z">
          <Path.Fill>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <LinearGradientBrush.GradientStops>
                <GradientStop Color="#FF1A52AD" Offset="0" />
                <GradientStop Color="#FF0F3168" Offset="1" />
              </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
          </Path.Fill>
        </Path>
      </RepeatButton>
      <RepeatButton ClickMode="Hover" Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Stretch" Width="Auto" Height="12" VerticalAlignment="Bottom" Style="{StaticResource ScrollButtonStyle}">
        <RepeatButton.Visibility>
          <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedVerticalScrollBarVisibility" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalOffset" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentHeight" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportHeight" />
          </MultiBinding>
        </RepeatButton.Visibility>
        <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="5" Height="3" Data="M0,0L1,1 2,0z">
          <Path.Fill>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <LinearGradientBrush.GradientStops>
                <GradientStop Color="#FF1A52AD" Offset="0" />
                <GradientStop Color="#FF0F3168" Offset="1" />
              </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
          </Path.Fill>
        </Path>
      </RepeatButton>
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="ScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}">
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <Grid x:Name="Grid" Background="{TemplateBinding Background}">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="*" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Rectangle x:Name="Corner" Grid.Column="1" Fill="{StaticResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1" />
        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0" />
        <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" />
        <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" />
      </Grid>
    </Border>
  </ControlTemplate>
  <Style x:Key="RibbonContextualTabGroupStyle" TargetType="{x:Type Fluent:RibbonContextualTabGroup}">
    <Setter Property="Template" Value="{StaticResource RibbonContextualTabGroupControlTemplate}" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <Style x:Key="RibbonTitleBarStyle" TargetType="{x:Type Fluent:RibbonTitleBar}">
    <Setter Property="Template" Value="{StaticResource RibbonTitleBarControlTemplate}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="FocusManager.IsFocusScope" Value="False" />
  </Style>
  <Style x:Key="KeyTipStyle" TargetType="Fluent:KeyTip">
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" Value="0.5" />
      </Trigger>
    </Style.Triggers>
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Fluent:KeyTip">
          <Grid>
            <Border Background="#FF525252">
              <TextBlock Text="{TemplateBinding Content}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4,-1,4,1" Foreground="White" />
            </Border>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="ToolbarDropDownButtonControlTemplate" TargetType="{x:Type Fluent:DropDownButton}">
    <Grid>
      <Border x:Name="PART_ButtonBorder" BorderThickness="1" CornerRadius="2" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="22" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="13">
        <Border x:Name="border1" Height="Auto" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Background="{StaticResource TransparentBrush}">
          <Grid x:Name="grid" Margin="0" Background="#00000000">
            <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed" Margin="0">
              <Rectangle.Fill>
                <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
                  <GradientStop Color="#7FFFFFFF" Offset="0" />
                  <GradientStop Offset="1" />
                </RadialGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Horizontal" VerticalAlignment="Top" Margin="-1,4,0,0" Background="#00000000">
              <Image x:Name="iconImage" HorizontalAlignment="Left" Height="8" Stretch="None" VerticalAlignment="Top" Source="{TemplateBinding LargeIcon}" Width="8" Margin="-3,0,2,0" />
            </StackPanel>
          </Grid>
        </Border>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                <ScrollViewer Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" CornerRadius="0,0,1,1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.25" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Source" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="2" />
        <Setter Property="Margin" TargetName="grid" Value="0" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Source" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="VerticalAlignment" TargetName="PART_ButtonBorder" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="2" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonPressedInnerBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
        <Setter Property="Margin" TargetName="rectangle" Value="0" />
        <Setter Property="Margin" TargetName="grid" Value="0" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsFocused" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="MenuSeparatorControlTemplate" TargetType="{x:Type Separator}">
    <Grid Height="Auto">
      <Path Fill="{x:Null}" Stretch="Fill" Stroke="{StaticResource ContextMenuSeparatorBrush}" StrokeDashArray="2 2" Margin="32,1,3,2" VerticalAlignment="Center" Height="1" Data="M0,0L1,0" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="MenuGroupSeparatorStyle" TargetType="{x:Type Fluent:GroupSeparatorMenuItem}">
    <Setter Property="Template" Value="{StaticResource MenuGroupSeparatorControlTemplate}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
  </Style>
  <Style x:Key="{x:Type Fluent:GroupSeparatorMenuItem}" TargetType="{x:Type Fluent:GroupSeparatorMenuItem}" BasedOn="{StaticResource MenuGroupSeparatorStyle}" />
  <Style x:Key="GalleryDropDownButtonStyle" TargetType="{x:Type Fluent:DropDownButton}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:DropDownButton}">
          <Grid>
            <Border x:Name="PART_ButtonBorder" Background="Transparent">
              <Fluent:TwoLineLabel x:Name="twoLineLabel" Text="{Binding Header, RelativeSource={RelativeSource TemplatedParent}}" HasTwoLines="False" HasGlyph="True" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6,0,0,0" />
            </Border>
            <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
              <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="10" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="10" />
                </Grid.ColumnDefinitions>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
                  <Rectangle.Fill>
                    <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                      <GradientStop Color="#3F000000" Offset="0" />
                      <GradientStop Color="#00000000" Offset="1" />
                    </RadialGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
                <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
                  <Rectangle.Fill>
                    <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                      <GradientStop Color="#3F000000" Offset="0" />
                      <GradientStop Color="#00000000" Offset="1" />
                    </RadialGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
                <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
                  <Rectangle.Fill>
                    <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                      <GradientStop Color="#3F000000" Offset="0" />
                      <GradientStop Color="#00000000" Offset="1" />
                    </RadialGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
                <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
                  <Rectangle.Fill>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                      <GradientStop Color="#3F000000" Offset="0" />
                      <GradientStop Color="#00000000" Offset="1" />
                    </LinearGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
                <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
                  <Rectangle.Fill>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                      <GradientStop Color="#3F000000" Offset="0" />
                      <GradientStop Color="#00000000" Offset="1" />
                    </LinearGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
                <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                  <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                    <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
                    <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                      <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                      <ScrollViewer Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                        <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                      </ScrollViewer>
                    </Grid>
                  </Grid>
                </Border>
              </Grid>
            </Popup>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Foreground" TargetName="twoLineLabel" Value="#FFFFD232" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:GalleryItem}" x:Key="GalleryItemControlTemplate">
    <Grid Background="{StaticResource TransparentBrush}">
      <Border x:Name="hoverBorder" d:LayoutOverrides="Width, Height" BorderThickness="4" Visibility="Collapsed">
        <Border.BorderBrush>
          <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
        </Border.BorderBrush>
      </Border>
      <Border x:Name="selectedBorder" d:LayoutOverrides="Width, Height" BorderThickness="4" Visibility="Collapsed">
        <Border.BorderBrush>
          <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.2" />
        </Border.BorderBrush>
      </Border>
      <ContentPresenter x:Name="contentPresenter" Margin="1" Opacity="1" />
      <Border x:Name="pressedBorder" BorderThickness="4" d:LayoutOverrides="Width, Height" Visibility="Collapsed">
        <Border.BorderBrush>
          <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.3" />
        </Border.BorderBrush>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <Trigger Property="IsSelected" Value="True">
        <Setter Property="Visibility" TargetName="selectedBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Visibility" TargetName="selectedBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="Visibility" TargetName="pressedBorder" Value="Visible" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="GalleryItemStyle" TargetType="{x:Type Fluent:GalleryItem}">
    <Setter Property="Template" Value="{StaticResource GalleryItemControlTemplate}" />
    <!--<Setter Property="Width" Value="{Binding ItemWidth, FallbackValue=0, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:RibbonItemsControl}}, Diagnostics:PresentationTraceSources.TraceLevel=None}"/>
    <Setter Property="Height" Value="{Binding ItemHeight, FallbackValue=0, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:RibbonItemsControl}}, Diagnostics:PresentationTraceSources.TraceLevel=None}"/>-->
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <ControlTemplate TargetType="{x:Type ComboBoxItem}" x:Key="noneditComboboxItemControlTemplate">
    <Grid Background="{StaticResource TransparentBrush}">
      <Border x:Name="hoverBorder" BorderThickness="1" Visibility="Collapsed">
        <Border.Background>
          <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
        </Border.Background>
        <Border Height="Auto" BorderThickness="1">
          <Border.Background>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
          </Border.Background>
        </Border>
      </Border>
      <Border x:Name="selectedBorder" BorderThickness="1" Visibility="Collapsed">
        <Border.Background>
          <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.2" />
        </Border.Background>
        <Border Height="Auto" BorderThickness="1">
          <Border.Background>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.2" />
          </Border.Background>
        </Border>
      </Border>
      <ContentPresenter x:Name="contentPresenter" Margin="3" Opacity="1" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <Trigger Property="IsSelected" Value="True">
        <Setter Property="Visibility" TargetName="selectedBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsFocused" Value="True">
        <Setter Property="Visibility" TargetName="selectedBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Visibility" TargetName="hoverBorder" Value="Visible" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="EditableComboBoxItemStyle" TargetType="{x:Type ComboBoxItem}">
    <Setter Property="Template" Value="{StaticResource noneditComboboxItemControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <Style x:Key="NonEditableComboBoxItemStyle" TargetType="{x:Type ComboBoxItem}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ComboBoxItem}" x:Name="noneditComboboxItem">
          <Grid Background="{StaticResource TransparentBrush}">
            <Border x:Name="hoverBorder" BorderThickness="1" Visibility="Collapsed">
              <Border.Background>
                <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
              </Border.Background>
              <Border Height="Auto" BorderThickness="1">
                <Border.Background>
                  <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.12" />
                </Border.Background>
              </Border>
            </Border>
            <Border x:Name="selectedBorder" BorderThickness="1" Visibility="Collapsed">
              <Border.Background>
                <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.2" />
              </Border.Background>
              <Border Height="Auto" BorderThickness="1">
                <Border.Background>
                  <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.2" />
                </Border.Background>
              </Border>
            </Border>
            <ContentPresenter x:Name="contentPresenter" Margin="3" Opacity="1" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
              <Setter Property="Visibility" TargetName="selectedBorder" Value="Visible" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Visibility" TargetName="hoverBorder" Value="Visible" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <ControlTemplate x:Key="InRibbonGalleryToggleButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="1" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
      <Grid Height="Auto">
        <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
          <Rectangle.Fill>
            <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
              <GradientStop Color="#7FFFFFFF" Offset="0" />
              <GradientStop Offset="1" />
            </RadialGradientBrush>
          </Rectangle.Fill>
        </Rectangle>
        <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Vertical">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" Margin="2" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" Style="{StaticResource TwoLineLabelStyle}" HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="2,-2,2,2" HasGlyph="True" />
        </StackPanel>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,2,0,2" />
        <Setter Property="Margin" TargetName="controlLabel" Value="-2,0,2,2" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-2,2,2" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,2,2,2" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Top" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsChecked" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="InRibbonGalleryButton" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:ToggleButton}">
          <Border BorderBrush="{StaticResource ButtonBorderBrush}" BorderThickness="1,1,1,1" x:Name="border" Background="White">
            <Grid x:Name="grid">
              <Path Margin="0,6,0,0" VerticalAlignment="Top" Height="1" Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF000000" Data="M0,0L1,0" HorizontalAlignment="Center" Width="7" />
              <Path Margin="0,8,0,0" VerticalAlignment="Top" Height="3" Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" Data="M0,0L1,1 2,0z" Width="5" HorizontalAlignment="Center" StrokeThickness="0" />
            </Grid>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" TargetName="grid" Value="0.5" />
              <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonDisabledBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonDisabledBorderBrush}" />
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="InRibbonGalleryRepeatButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border BorderBrush="{StaticResource ButtonBorderBrush}" BorderThickness="1" x:Name="border" Background="White">
            <ContentPresenter x:Name="contentPresenter" />
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
              <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonDisabledBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonDisabledBorderBrush}" />
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
              <!--<Setter Property="BorderBrush"
                                    TargetName="border"
                                    Value="{DynamicResource ButtonHoverOuterBorderBrush}" />-->
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedInnerBackgroundBrush}" />
              <!--<Setter Property="BorderBrush"
                                    TargetName="border"
                                    Value="{DynamicResource ButtonPressedOuterBorderBrush}" />-->
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="BackstageTabItemStyle" TargetType="{x:Type Fluent:BackstageTabItem}">
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource BackstageFontBrush}" />
    <Setter Property="Template" Value="{StaticResource BackstageTabItemControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="Height" Value="38" />
    <Setter Property="Background" Value="{Binding Background,&#xD;&#xA;                                RelativeSource={RelativeSource FindAncestor,&#xD;&#xA;                                                               AncestorType={x:Type Fluent:BackstageTabControl}}}" />
    <Setter Property="Margin" Value="0" />
  </Style>
  <ControlTemplate x:Key="ButtonBackstageControlTemplate" TargetType="{x:Type Fluent:Button}">
    <Grid x:Name="grid">
      <Border x:Name="border" BorderThickness="1" Margin="0" Background="Transparent" BorderBrush="LightGray">
        <StackPanel Margin="2" x:Name="stackPanel">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" Width="32" VerticalAlignment="Center" Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Margin="9,9,9,0" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="twoLineLabel" Margin="7,7,7,5" VerticalAlignment="Center" Text="{TemplateBinding Header}" />
        </StackPanel>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="twoLineLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="HorizontalAlignment" TargetName="stackPanel" Value="Center" />
        <Setter Property="VerticalAlignment" TargetName="stackPanel" Value="Center" />
        <Setter Property="Margin" TargetName="twoLineLabel" Value="2" />
        <Setter Property="Width" TargetName="grid" Value="Auto" />
        <Setter Property="Height" TargetName="grid" Value="Auto" />
        <Setter Property="HorizontalAlignment" TargetName="twoLineLabel" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="twoLineLabel" Value="False" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="VerticalAlignment" TargetName="stackPanel" Value="Center" />
        <Setter Property="Margin" TargetName="twoLineLabel" Value="7,0" />
        <Setter Property="Margin" TargetName="iconImage" Value="9,2,9,0" />
        <Setter Property="Width" TargetName="grid" Value="Auto" />
        <Setter Property="Height" TargetName="grid" Value="Auto" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="BorderBrush" TargetName="border" Value="#FFC8C8C9" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.3" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsFocused" Value="True">
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.3" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.5" />
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="ToggleButtonBackstageControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Grid x:Name="grid">
      <Border x:Name="border" BorderThickness="1" Margin="0" BorderBrush="LightGray">
        <StackPanel x:Name="stackPanel">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" Margin="9,9,9,0" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="twoLineLabel" Margin="7,7,7,5" VerticalAlignment="Center" Text="{TemplateBinding Header}" />
        </StackPanel>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="twoLineLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <!--<Setter Property="BorderBrush" TargetName="border" Value="#FFC8C8C9"/>-->
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="HorizontalAlignment" TargetName="stackPanel" Value="Center" />
        <Setter Property="VerticalAlignment" TargetName="stackPanel" Value="Center" />
        <Setter Property="Margin" TargetName="twoLineLabel" Value="2" />
        <Setter Property="Width" TargetName="grid" Value="Auto" />
        <Setter Property="Height" TargetName="grid" Value="Auto" />
        <Setter Property="HorizontalAlignment" TargetName="twoLineLabel" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="twoLineLabel" Value="False" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="VerticalAlignment" TargetName="stackPanel" Value="Center" />
        <Setter Property="Margin" TargetName="twoLineLabel" Value="7,0" />
        <Setter Property="Margin" TargetName="iconImage" Value="9,2,9,0" />
        <Setter Property="Width" TargetName="grid" Value="Auto" />
        <Setter Property="Height" TargetName="grid" Value="Auto" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.3" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsFocused" Value="True">
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.3" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.5" />
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.3" />
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="border">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Opacity="0.2" />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="DropDownButtonBackstageControlTemplate" TargetType="{x:Type Fluent:DropDownButton}">
    <Grid>
      <Border x:Name="PART_ButtonBorder" BorderThickness="1" Margin="0" BorderBrush="LightGray">
        <StackPanel x:Name="stackPanel" Margin="0">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" Margin="7,7,7,0" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="twoLineLabel" Margin="5,5,5,3" VerticalAlignment="Center" HasGlyph="True" Text="{TemplateBinding Header}" />
        </StackPanel>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                <ScrollViewer Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" CornerRadius="0,0,1,1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="twoLineLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="#FFC8C8C9" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.3" />
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsFocused" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.3" />
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.5" />
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate TargetType="{x:Type Fluent:GalleryItem}" x:Key="GalleryItemBackstageControlTemplate">
    <Grid Background="{StaticResource TransparentBrush}">
      <Border x:Name="hoverBorder" BorderThickness="1" Background="Transparent">
        <ContentPresenter x:Name="contentPresenter" Margin="1" Opacity="1" />
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <Trigger Property="IsSelected" Value="True">
        <Setter Property="Background" TargetName="hoverBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="hoverBorder" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="GalleryItemBackstageStyle" TargetType="{x:Type Fluent:GalleryItem}">
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="Template" Value="{StaticResource GalleryItemBackstageControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <ControlTemplate TargetType="{x:Type ComboBoxItem}" x:Key="ComboBoxItemBackstageControlTemplate">
    <Grid Background="{StaticResource TransparentBrush}" HorizontalAlignment="Stretch">
      <Border x:Name="hoverBorder" Background="Transparent">
        <ContentPresenter x:Name="contentPresenter" Margin="1" Opacity="1" />
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <Trigger Property="IsSelected" Value="True">
        <Setter Property="Background" TargetName="hoverBorder">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.5" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="hoverBorder">
          <Setter.Value>
            <SolidColorBrush Color="{Binding RibbonThemeColor.Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, FallbackValue=Blue}" Opacity="0.3" />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="MetroComboBoxItemBackstageStyle" TargetType="{x:Type ComboBoxItem}">
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="MinHeight" Value="40" />
    <Setter Property="Template" Value="{StaticResource ComboBoxItemBackstageControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <ControlTemplate x:Key="SpinnerButtonBackstageControlTemplate" TargetType="{x:Type RepeatButton}">
    <Border x:Name="border" BorderThickness="1" CornerRadius="2" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
      <Border x:Name="border1" Height="Auto" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Background="{StaticResource TransparentBrush}">
        <Grid Height="Auto">
          <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
                <GradientStop Color="#7FFFFFFF" Offset="0" />
                <GradientStop Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" />
        </Grid>
      </Border>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Border.BorderThickness" Value="0,1,0,0">
        <Setter Property="CornerRadius" TargetName="border" Value="0,2,0,0" />
        <Setter Property="CornerRadius" TargetName="border1" Value="0,1,0,0" />
      </Trigger>
      <Trigger Property="Border.BorderThickness" Value="0,0,1,0">
        <Setter Property="CornerRadius" TargetName="border" Value="0,0,3,0" />
        <Setter Property="CornerRadius" TargetName="border1" Value="0,0,2,0" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="False" />
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonPressedInnerBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="SpinnerButtonBackstageStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="Template" Value="{StaticResource SpinnerButtonBackstageControlTemplate}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <Style x:Key="SpinnerBackstageStyle" TargetType="{x:Type Fluent:Spinner}">
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:Spinner}">
          <Grid Width="Auto" Height="22" Background="#00000000">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="stackPanel" HorizontalAlignment="Left" Margin="0">
              <Image Width="16" Height="16" VerticalAlignment="Center" Margin="4,0,3,0" Source="{TemplateBinding Icon}" />
              <TextBlock Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="2,0,4,0" x:Name="textBlock" />
            </StackPanel>
            <Border x:Name="border" Height="22" BorderThickness="1" Background="{StaticResource TextBoxBackgroundBrush}" Grid.ColumnSpan="1" Grid.Column="1" Width="{TemplateBinding InputWidth}" CornerRadius="2">
              <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                  <GradientStop Color="#FFABAFB2" Offset="0" />
                  <GradientStop Color="#FFE1E6EC" Offset="1" />
                </LinearGradientBrush>
              </Border.BorderBrush>
              <Grid Grid.ColumnSpan="1" Grid.Column="1">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="17" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <TextBox x:Name="PART_TextBox" BorderThickness="0" Grid.RowSpan="2" Grid.Column="0" Background="{StaticResource TextBoxBackgroundBrush}" Margin="1,0,0,0" Padding="1" />
                <Border x:Name="border1" BorderBrush="#FFBEC1C4" BorderThickness="1" Margin="0,-1,-1,0" Grid.RowSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="0,2,0,0" Grid.Column="1" Visibility="Collapsed">
                  <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                      <GradientStop Color="White" Offset="0" />
                      <GradientStop Color="#FFF1F2F2" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                </Border>
                <Border x:Name="border2" BorderBrush="#FFBEC1C4" BorderThickness="1" Grid.ColumnSpan="1" Margin="0,-1,-1,-1" Grid.RowSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="18" CornerRadius="0,0,2,0" Grid.Column="1" Grid.Row="1" Visibility="Collapsed">
                  <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                      <GradientStop Color="White" Offset="0" />
                      <GradientStop Color="#FFF1F2F2" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                </Border>
                <RepeatButton x:Name="PART_ButtonUp" Grid.Column="1" Grid.Row="0" Style="{StaticResource SpinnerButtonBackstageStyle}" RenderTransformOrigin="0,0.5" HorizontalAlignment="Stretch" BorderThickness="0,1,0,0" Margin="0,-1,-1,0">
                  <Path Width="7" Height="4" Fill="#FF757778" Stretch="Fill" Stroke="#FF000000" Data="M0,0L1,-1 2,0" HorizontalAlignment="Center" StrokeThickness="0" VerticalAlignment="Center" Margin="1,1,0,1" RenderOptions.EdgeMode="Aliased" />
                </RepeatButton>
                <RepeatButton x:Name="PART_ButtonDown" Grid.Column="1" Grid.Row="1" Style="{StaticResource SpinnerButtonBackstageStyle}" BorderThickness="0,0,1,0" Margin="0,0,-1,-1">
                  <Path Width="7" Height="4" Fill="#FF757778" Stretch="Fill" Stroke="#FF000000" Data="M0,0L1,1 2,0" StrokeThickness="0" HorizontalAlignment="Center" Margin="1,0,0,0" VerticalAlignment="Center" RenderOptions.EdgeMode="Aliased" />
                </RepeatButton>
              </Grid>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="IsEnabled" TargetName="PART_TextBox" Value="False" />
              <Setter Property="Background" TargetName="border" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBoxDisabledBorderBrush}" />
              <Setter Property="Background" TargetName="PART_TextBox" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
            </Trigger>
            <Trigger Property="Size" Value="Middle">
              <Setter Property="Visibility" TargetName="textBlock" Value="Collapsed" />
            </Trigger>
            <Trigger Property="Size" Value="Small">
              <Setter Property="Visibility" TargetName="stackPanel" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" TargetName="border" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
              <Setter Property="Background" TargetName="PART_TextBox" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border">
                <Setter.Value>
                  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFCFAF5A" Offset="0" />
                    <GradientStop Color="#FFEFDA71" Offset="1" />
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
              <Setter Property="Visibility" TargetName="border1" Value="Visible" />
              <Setter Property="Visibility" TargetName="border2" Value="Visible" />
              <Setter Property="BorderBrush" TargetName="border1" Value="#E5BEC1C4" />
              <Setter Property="BorderBrush" TargetName="border2" Value="#E5BEC1C4" />
            </Trigger>
            <Trigger Property="IsFocused" Value="True" SourceName="PART_TextBox">
              <Setter Property="Background" TargetName="border" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
              <Setter Property="Background" TargetName="PART_TextBox" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border">
                <Setter.Value>
                  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFCFAF5A" Offset="0" />
                    <GradientStop Color="#FFEFDA71" Offset="1" />
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
              <Setter Property="Visibility" TargetName="border1" Value="Visible" />
              <Setter Property="Visibility" TargetName="border2" Value="Visible" />
              <Setter Property="BorderBrush" TargetName="border1" Value="#E5BEC1C4" />
              <Setter Property="BorderBrush" TargetName="border2" Value="#E5BEC1C4" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="InnerBackstageTabCotrolItem" TargetType="{x:Type TabItem}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TabItem}">
          <Grid Background="#00000000" Margin="0,3">
            <Border x:Name="border" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" Margin="0" Background="{StaticResource TransparentBrush}">
              <ContentPresenter Margin="5,5,50,5" ContentSource="Header" />
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="Selector.IsSelected" Value="True">
              <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="Selector.IsSelected" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
            </MultiTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="InnerBackstageTabControlStyle" TargetType="{x:Type TabControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TabControl}">
          <ControlTemplate.Resources>
            <Style TargetType="{x:Type Fluent:SeparatorTabItem}" BasedOn="{StaticResource InnerBackstageSeparatorTabItemStyle}" />
            <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource InnerBackstageTabCotrolItem}" />
          </ControlTemplate.Resources>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border BorderThickness="0,0,1,0" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Stretch">
              <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                  <GradientStop Offset="1" Color="#00D2D3D4" />
                  <GradientStop Color="#7FD2D3D4" />
                  <GradientStop Color="#FFD2D3D4" Offset="0.246" />
                  <GradientStop Color="#FFD2D3D4" Offset="0.797" />
                </LinearGradientBrush>
              </Border.BorderBrush>
            </Border>
            <StackPanel Grid.Column="0" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" IsItemsHost="True" />
            <ContentPresenter x:Name="PART_SelectedContentHost" Grid.Column="1" Margin="0" VerticalAlignment="Stretch" ContentSource="SelectedContent" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="BackstageButtonStyle" TargetType="{x:Type Fluent:Button}">
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="Height" Value="26" />
    <Setter Property="Margin" Value="5,1" />
    <Setter Property="Template" Value="{StaticResource BackstageButtonControlTemplate}" />
    <Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:BackstageTabControl}}, FallbackValue=Red}" />
    <Setter Property="Foreground" Value="{StaticResource BackstageFontBrush}" />
  </Style>
  <Style TargetType="{x:Type Fluent:SeparatorTabItem}" x:Key="BackstageSeparatorTabItemStyle">
    <Setter Property="Margin" Value="25,10,20,10" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:SeparatorTabItem}">
          <StackPanel>
            <TextBlock x:Name="header" Margin="10,5" TextWrapping="Wrap" Text="{TemplateBinding Header}" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="{StaticResource BackstageFontBrush}" Visibility="Visible" />
            <Line MinWidth="75" Height="2" X2="1" StrokeThickness="1.25" Stroke="White" Stretch="Uniform" Opacity="0.3" />
          </StackPanel>
          <ControlTemplate.Triggers>
            <Trigger Property="HasHeader" Value="False">
              <Setter TargetName="header" Property="Visibility" Value="Collapsed" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="RibbonSeparatorStyle" TargetType="{x:Type Separator}">
    <Setter Property="Margin" Value="4,0,4,0" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Separator">
          <Border BorderThickness="1,0" Width="3" Height="Auto" VerticalAlignment="Stretch" Background="{StaticResource RibbonSeparatorBackgroundBrush}" BorderBrush="{StaticResource RibbonSeparatorBorderBrush}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="RibbonToolBarStyle" TargetType="{x:Type Fluent:RibbonToolBar}">
    <Setter Property="Focusable" Value="False" />
    <Setter Property="SeparatorStyle">
      <Setter.Value>
        <Style TargetType="{x:Type Separator}" BasedOn="{StaticResource RibbonSeparatorStyle}">
          <Setter Property="Margin" Value="4" />
        </Style>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="RibbonToolBarControlGroupTemplate" TargetType="{x:Type Fluent:RibbonToolBarControlGroup}">
    <StackPanel Orientation="Horizontal">
      <Separator x:Name="separatorLeft" Visibility="Collapsed" Style="{StaticResource RibbonSeparatorStyle}" />
      <StackPanel Orientation="Horizontal" IsItemsHost="true" />
      <Separator x:Name="separatorRight" Visibility="Collapsed" Style="{StaticResource RibbonSeparatorStyle}" />
    </StackPanel>
    <ControlTemplate.Triggers>
      <Trigger Property="IsLastInRow" Value="False">
        <Setter Property="Visibility" TargetName="separatorRight" Value="Visible" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="{x:Static StatusBar.SeparatorStyleKey}" TargetType="{x:Type Separator}">
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Separator}">
          <Border BorderThickness="1,0" Margin="0,-1,0,0" Width="3" Background="{StaticResource StatusBarSeparatorBackgroundBrush}" BorderBrush="{StaticResource StatusBarSeparatorBorderBrush}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Name="Border" Margin="0" BorderThickness="1" BorderBrush="{StaticResource ScrollButtonDefaultBorderBrush}" Background="{StaticResource ScrollButtonDefaultBackgroundBrush}">
            <Path x:Name="path" Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" />
          </Border>
          <ControlTemplate.Triggers>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource ScrollButtonHoverBorderBrush}" />
              <Setter Property="Background" TargetName="Border" Value="{StaticResource ScrollButtonHoverBackgroundBrush}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource ScrollButtonPressedBorderBrush}" />
              <Setter Property="Background" TargetName="Border" Value="{StaticResource ScrollButtonPressedBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" TargetName="path" Value="0.5" />
              <Setter Property="Background" TargetName="Border" Value="{StaticResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource TransparentBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Foreground">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FF747576" Offset="0" />
          <GradientStop Color="#FF454647" Offset="1" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border x:Name="border" BorderThickness="1" Background="{StaticResource ScrollThumbDefaultBackgroundBrush}" BorderBrush="{StaticResource ScrollThumbDefaultBorderBrush}" />
          <ControlTemplate.Triggers>
            <Trigger Property="IsDragging" Value="True">
              <Setter Property="Background" TargetName="border" Value="{StaticResource ScrollThumbPressedBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollThumbPressedBorderBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" TargetName="border" Value="{StaticResource ScrollThumbHoverBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollThumbHoverBorderBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="VerticalScrollBarLineButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Name="Border" Margin="0" BorderThickness="1" BorderBrush="{StaticResource ScrollButtonDefaultBorderBrush}" Background="{StaticResource ScrollButtonDefaultBackgroundBrush}">
            <Path x:Name="path" Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="#FF777777" />
          </Border>
          <ControlTemplate.Triggers>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource ScrollButtonHoverBorderBrush}" />
              <Setter Property="Background" TargetName="Border" Value="{StaticResource ScrollButtonHoverBackgroundBrush}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource ScrollButtonPressedBorderBrush}" />
              <Setter Property="Background" TargetName="Border" Value="{StaticResource ScrollButtonPressedBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" TargetName="path" Value="0.5" />
              <Setter Property="Background" TargetName="Border" Value="{StaticResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource TransparentBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="VerticalScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border x:Name="border" BorderThickness="1" Background="{StaticResource ScrollThumbDefaultBackgroundBrush}" BorderBrush="{StaticResource ScrollThumbDefaultBorderBrush}" />
          <ControlTemplate.Triggers>
            <Trigger Property="IsDragging" Value="True">
              <Setter Property="Background" TargetName="border" Value="{StaticResource ScrollThumbPressedBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollThumbPressedBorderBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" TargetName="border" Value="{StaticResource ScrollThumbHoverBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ScrollThumbHoverBorderBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition MaxHeight="18" />
        <RowDefinition Height="0.00001*" />
        <RowDefinition MaxHeight="18" />
      </Grid.RowDefinitions>
      <Border Grid.RowSpan="3" CornerRadius="0" Background="{StaticResource ScrollVerticalBackgroundBrush}" />
      <RepeatButton x:Name="repeatButton" Grid.Row="0" Style="{StaticResource VerticalScrollBarLineButton}" Height="17" Command="ScrollBar.LineUpCommand" Content="M 0 4 L 8 4 L 4 0 Z" VerticalAlignment="Top" Margin="1,1,1,0" Background="White" />
      <Track Name="PART_Track" Grid.Row="1" IsDirectionReversed="true" ViewportSize="{TemplateBinding ViewportSize}">
        <Track.Resources>
          <!-- Set the Thumb's minimum height to 50.
                      The Thumb's minimum height is half the
                      value of VerticalScrollBarButtonHeightKey. -->
          <System:Double x:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}">
              36
            </System:Double>
        </Track.Resources>
        <Track.DecreaseRepeatButton>
          <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb Style="{StaticResource VerticalScrollBarThumb}" Margin="1,0,1,0" RenderTransformOrigin="0.5,0.5" />
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton x:Name="repeatButton1" Grid.Row="3" Style="{StaticResource VerticalScrollBarLineButton}" Height="17" Command="ScrollBar.LineDownCommand" Content="M 0 0 L 4 4 L 8 0 Z" Margin="1,0,1,1" Background="White" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="repeatButton" Value="{x:Null}" />
        <Setter Property="Background" TargetName="repeatButton1" Value="{x:Null}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition MaxWidth="18" />
        <ColumnDefinition Width="0.00001*" />
        <ColumnDefinition MaxWidth="18" />
      </Grid.ColumnDefinitions>
      <Border Grid.ColumnSpan="3" CornerRadius="0" Margin="0" Background="{StaticResource ScrollBackgroundBrush}" />
      <RepeatButton x:Name="repeatButton" Grid.Column="0" Style="{StaticResource ScrollBarLineButton}" Width="17" Command="ScrollBar.LineLeftCommand" Content="M 4 0 L 4 8 L 0 4 Z" Margin="1,1,0,1" Background="White" />
      <Track Name="PART_Track" Grid.Column="1" IsDirectionReversed="False" Margin="0,0,0,1" ViewportSize="{TemplateBinding ViewportSize}">
        <Track.Resources>
          <!-- Set the Thumb's minimum height to 50.
                      The Thumb's minimum height is half the
                      value of VerticalScrollBarButtonHeightKey. -->
          <System:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}">
              36
            </System:Double>
        </Track.Resources>
        <Track.DecreaseRepeatButton>
          <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageLeftCommand" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb Style="{StaticResource ScrollBarThumb}" Margin="0,0,0,0" />
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageRightCommand" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton x:Name="repeatButton1" Grid.Column="3" Style="{StaticResource ScrollBarLineButton}" Width="17" Command="ScrollBar.LineRightCommand" Content="M 0 0 L 4 4 L 0 8 Z" Margin="0,1,1,1" Background="White" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="repeatButton" Value="{x:Null}" />
        <Setter Property="Background" TargetName="repeatButton1" Value="{x:Null}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="ScrollBar">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Width" Value="Auto" />
        <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
        <Setter Property="Height" Value="17" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
        <Setter Property="Width" Value="17" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style TargetType="ScrollBar" x:Key="ScrollBarWhite">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Width" Value="Auto" />
        <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
        <Setter Property="Height" Value="17" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
        <Setter Property="Width" Value="17" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style TargetType="{x:Type Fluent:TextBox}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:TextBox}">
          <Border Width="Auto" Background="#00000000" Height="22">
            <Grid Width="Auto" Height="Auto" Background="#00000000">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
              </Grid.ColumnDefinitions>
              <StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="stackPanel" HorizontalAlignment="Left" Margin="0,0,4,0">
                <ContentPresenter x:Name="iconImage" Width="16" Height="16" VerticalAlignment="Center" Margin="3,0,0,0" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
                <TextBlock Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,0,0" x:Name="textBlock" />
              </StackPanel>
              <Border Height="Auto" BorderThickness="1,1,1,1" BorderBrush="{StaticResource TextBoxBorderBrush}" x:Name="PART_ContentBorder" Background="{StaticResource TextBoxBackgroundBrush}" Grid.Column="1" Grid.ColumnSpan="1" Width="{TemplateBinding InputWidth}" HorizontalAlignment="Right">
                <TextBox HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" TextWrapping="NoWrap" BorderThickness="0,0,0,0" x:Name="PART_TextBox" Background="{StaticResource TextBoxBackgroundBrush}" />
              </Border>
            </Grid>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
              <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
            </Trigger>
            <Trigger Property="InputWidth" Value="NaN">
              <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
            </Trigger>
            <Trigger Property="Size" Value="Middle">
              <Setter Property="Visibility" TargetName="textBlock" Value="Collapsed" />
            </Trigger>
            <Trigger Property="Size" Value="Small">
              <Setter Property="Visibility" TargetName="stackPanel" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="IsEnabled" TargetName="PART_TextBox" Value="False" />
              <Setter Property="Background" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxDisabledBorderBrush}" />
              <Setter Property="BorderBrush" TargetName="PART_TextBox" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
              <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
              <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
              <Setter Property="Effect" TargetName="iconImage">
                <Setter.Value>
                  <Fluent:GrayscaleEffect />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxHoverBorderBrush}" />
              <Setter Property="Background" TargetName="PART_TextBox" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
              <Setter Property="Background" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsKeyboardFocusWithin" Value="True">
              <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxHoverBorderBrush}" />
              <Setter Property="Background" TargetName="PART_TextBox" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
              <Setter Property="Background" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <ContextMenu x:Key="TextBoxContextMenu" x:Shared="False">
    <ContextMenu.Resources>
      <BitmapImage x:Key="MenuCutIcon" UriSource="pack://application:,,,/Fluent;component/Themes\Office2010\Images\Cut.png" PresentationOptions:Freeze="True" />
      <BitmapImage x:Key="MenuCopyIcon" UriSource="pack://application:,,,/Fluent;component/Themes\Office2010\Images\Copy.png" PresentationOptions:Freeze="True" />
      <BitmapImage x:Key="MenuPasteIcon" UriSource="pack://application:,,,/Fluent;component/Themes\Office2010\Images\Paste.png" PresentationOptions:Freeze="True" />
    </ContextMenu.Resources>
    <Fluent:MenuItem Icon="{StaticResource MenuCutIcon}" Command="ApplicationCommands.Cut" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
    <Fluent:MenuItem Icon="{StaticResource MenuCopyIcon}" Command="ApplicationCommands.Copy" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
    <Fluent:MenuItem Icon="{StaticResource MenuPasteIcon}" Command="ApplicationCommands.Paste" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
  </ContextMenu>
  <ControlTemplate x:Key="SpinnerButtonControlTemplate" TargetType="{x:Type RepeatButton}">
    <Border x:Name="border" BorderThickness="1" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
      <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" />
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="False" />
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="SpinnerButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="Template" Value="{StaticResource SpinnerButtonControlTemplate}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <Style x:Key="SpinnerStyle" TargetType="{x:Type Fluent:Spinner}">
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:Spinner}">
          <Grid Width="Auto" Height="22" Background="#00000000">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="stackPanel" HorizontalAlignment="Left" Margin="0,0,3,0">
              <ContentPresenter x:Name="iconImage" Width="16" Height="16" VerticalAlignment="Center" Margin="4,0,0,0" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
              <TextBlock Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,4,0" x:Name="textBlock" />
            </StackPanel>
            <Border x:Name="border" Height="22" BorderThickness="1" BorderBrush="{StaticResource TextBoxBorderBrush}" Background="{StaticResource TextBoxBackgroundBrush}" Grid.ColumnSpan="1" Grid.Column="1" Width="{TemplateBinding InputWidth}" HorizontalAlignment="Right">
              <Grid Grid.ColumnSpan="1" Grid.Column="1">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="17" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <TextBox x:Name="PART_TextBox" BorderThickness="0" Grid.RowSpan="2" Grid.Column="0" Background="{StaticResource TextBoxBackgroundBrush}" Foreground="{TemplateBinding Foreground}" Padding="2,0,2,0" Margin="0" />
                <Path Visibility="Collapsed" HorizontalAlignment="Left" Margin="0,-1,0,-1" x:Name="path" Width="1" Fill="#FF000000" Stretch="Fill" Stroke="{StaticResource TextBoxHoverBorderBrush}" StrokeThickness="1" Grid.Column="1" Grid.RowSpan="2" Data="M0,0L0,1" />
                <Path HorizontalAlignment="Left" Margin="0,0,-1,0" Width="Auto" Fill="#FF000000" Stretch="Fill" Stroke="{StaticResource TextBoxHoverBorderBrush}" StrokeThickness="1" Data="M0,0L1,0" Visibility="Collapsed" x:Name="path1" VerticalAlignment="Bottom" Height="1" Grid.Column="1" Grid.RowSpan="1" />
                <RepeatButton x:Name="PART_ButtonUp" Grid.Column="1" Grid.Row="0" Style="{StaticResource SpinnerButtonStyle}" RenderTransformOrigin="0,0.5" HorizontalAlignment="Stretch">
                  <Path Width="5" Height="3" Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" Data="M0,0L1,-1 2,0" HorizontalAlignment="Center" StrokeThickness="0" VerticalAlignment="Center" Margin="1,2,0,1" RenderOptions.EdgeMode="Aliased" />
                </RepeatButton>
                <RepeatButton x:Name="PART_ButtonDown" Grid.Column="1" Grid.Row="1" Style="{StaticResource SpinnerButtonStyle}">
                  <Path Width="5" Height="3" Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" Data="M0,0L1,1 2,0" StrokeThickness="0" HorizontalAlignment="Center" Margin="1,-1,0,0" VerticalAlignment="Center" RenderOptions.EdgeMode="Aliased" />
                </RepeatButton>
              </Grid>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
              <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
            </Trigger>
            <Trigger Property="InputWidth" Value="NaN">
              <Setter Property="HorizontalAlignment" TargetName="border" Value="Stretch" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="IsEnabled" TargetName="PART_TextBox" Value="False" />
              <Setter Property="Background" TargetName="border" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBoxDisabledBorderBrush}" />
              <Setter Property="Background" TargetName="PART_TextBox" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
              <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
              <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
              <Setter Property="Effect" TargetName="iconImage">
                <Setter.Value>
                  <Fluent:GrayscaleEffect />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="Size" Value="Middle">
              <Setter Property="Visibility" TargetName="textBlock" Value="Collapsed" />
            </Trigger>
            <Trigger Property="Size" Value="Small">
              <Setter Property="Visibility" TargetName="stackPanel" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Visibility" TargetName="path" Value="Visible" />
              <Setter Property="Visibility" TargetName="path1" Value="Visible" />
              <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBoxHoverBorderBrush}" />
              <Setter Property="Background" TargetName="border" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
              <Setter Property="Background" TargetName="PART_TextBox" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="RibbonComboButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="1" CornerRadius="0" Background="White" BorderBrush="{StaticResource ButtonBorderBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
      <Grid Height="Auto" HorizontalAlignment="Right">
        <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed" Fill="White" />
        <Path x:Name="path" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M0,0L2,0 1,1z" Fill="{StaticResource DefaultFontBrush}" Margin="3,0,3,0" StrokeStartLineCap="Round" Stretch="Fill" StrokeEndLineCap="Round" Stroke="{StaticResource DefaultFontBrush}" StrokeThickness="1" StrokeMiterLimit="10" StrokeLineJoin="Round" Width="5" Height="4" StrokeDashCap="Round" IsHitTestVisible="False" />
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="path" Value="0.5" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsChecked" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Fill" TargetName="rectangle" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <GroupStyle x:Key="ComboBoxGroupStyle">
    <GroupStyle.ContainerStyle>
      <Style TargetType="{x:Type GroupItem}">
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type GroupItem}">
              <Grid>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid Height="21" Background="#FFF0F2F5" Grid.ColumnSpan="2" VerticalAlignment="Top">
                  <TextBlock Margin="7,0" Text="{Binding Name}" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
                </Grid>
                <Image Grid.Column="0" Stretch="None" Margin="4,21,4,0" VerticalAlignment="Top" HorizontalAlignment="Center" x:Name="iconImage">
                  <Image.Source>
                    <MultiBinding Converter="{StaticResource GroupIconConverter}">
                      <Binding Path="Items" />
                      <Binding ElementName="layoutRoot" />
                    </MultiBinding>
                  </Image.Source>
                </Image>
                <Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Right" Width="1" Height="Auto" Data="M0,0L0,1" Visibility="Visible" x:Name="menuLine" Margin="0,21,0,0" />
                <ItemsPresenter Grid.Column="1" Margin="0,21,0,0" />
              </Grid>
              <ControlTemplate.Triggers>
                <Trigger SourceName="iconImage" Property="Source" Value="{x:Null}">
                  <Setter TargetName="menuLine" Property="Visibility" Value="Collapsed" />
                  <Setter TargetName="iconImage" Property="Visibility" Value="Collapsed" />
                </Trigger>
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
    </GroupStyle.ContainerStyle>
  </GroupStyle>
  <Style x:Key="ColorGalleryListBox" TargetType="{x:Type ListBox}">
    <Setter Property="Background" Value="{StaticResource GalleryBackgroundBrush}" />
    <Setter Property="ItemTemplate">
      <Setter.Value>
        <DataTemplate>
          <Rectangle Stroke="{StaticResource RibbonTopBorderBrush}">
            <Rectangle.Fill>
              <SolidColorBrush Color="{Binding}" />
            </Rectangle.Fill>
          </Rectangle>
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListBox}">
          <Border Background="{TemplateBinding Background}" HorizontalAlignment="Stretch">
            <UniformGrid Rows="1" HorizontalAlignment="Left" IsItemsHost="True" Columns="{Binding Columns, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}}" />
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemContainerStyle">
      <Setter.Value>
        <Style TargetType="{x:Type ListBoxItem}">
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type ListBoxItem}">
                <Grid Background="Transparent">
                  <ContentPresenter Margin="2" Width="{Binding ChipWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}, FallbackValue=13}" Height="{Binding ChipHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}, FallbackValue=13}" />
                  <Border BorderThickness="1" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" x:Name="hoverBorder" Visibility="Collapsed" Margin="2">
                    <Border BorderThickness="1" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" />
                  </Border>
                  <Border BorderThickness="1" BorderBrush="{StaticResource ButtonPressedOuterBorderBrush}" x:Name="selectedBorder" Visibility="Collapsed" Margin="2">
                    <Border BorderThickness="1" BorderBrush="{StaticResource ButtonPressedInnerBorderBrush}" />
                  </Border>
                </Grid>
                <ControlTemplate.Triggers>
                  <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Visibility" Value="Visible" TargetName="hoverBorder" />
                  </Trigger>
                  <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Visibility" Value="Visible" TargetName="selectedBorder" />
                  </Trigger>
                </ControlTemplate.Triggers>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="HightlightColorGalleryListBox" TargetType="{x:Type ListBox}">
    <Setter Property="Background" Value="{StaticResource GalleryBackgroundBrush}" />
    <Setter Property="ItemTemplate">
      <Setter.Value>
        <DataTemplate>
          <Rectangle Stroke="{StaticResource RibbonTopBorderBrush}">
            <Rectangle.Fill>
              <SolidColorBrush Color="{Binding}" />
            </Rectangle.Fill>
          </Rectangle>
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListBox}">
          <Border Background="{TemplateBinding Background}" HorizontalAlignment="Stretch">
            <UniformGrid HorizontalAlignment="Left" IsItemsHost="True" Columns="{Binding Columns, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}}" />
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemContainerStyle">
      <Setter.Value>
        <Style TargetType="{x:Type ListBoxItem}">
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type ListBoxItem}">
                <Grid Background="Transparent">
                  <ContentPresenter Margin="2" Width="{Binding ChipWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}, FallbackValue=13}" Height="{Binding ChipHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}, FallbackValue=13}" />
                  <Border BorderThickness="1" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" x:Name="hoverBorder" Visibility="Collapsed" Margin="2">
                    <Border BorderThickness="1" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" />
                  </Border>
                  <Border BorderThickness="1" BorderBrush="{StaticResource ButtonPressedOuterBorderBrush}" x:Name="selectedBorder" Visibility="Collapsed" Margin="2">
                    <Border BorderThickness="1" BorderBrush="{StaticResource ButtonPressedInnerBorderBrush}" />
                  </Border>
                </Grid>
                <ControlTemplate.Triggers>
                  <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Visibility" Value="Visible" TargetName="hoverBorder" />
                  </Trigger>
                  <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Visibility" Value="Visible" TargetName="selectedBorder" />
                  </Trigger>
                </ControlTemplate.Triggers>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style>
      </Setter.Value>
    </Setter>
  </Style>
  <DataTemplate x:Key="GradientColorCenterDataTemplate">
    <Border BorderBrush="{StaticResource RibbonTopBorderBrush}" BorderThickness="1,0,1,0">
      <Border.Background>
        <SolidColorBrush Color="{Binding}" />
      </Border.Background>
    </Border>
  </DataTemplate>
  <DataTemplate x:Key="GradientColorTopDataTemplate">
    <Border BorderBrush="{StaticResource RibbonTopBorderBrush}" BorderThickness="1,1,1,0">
      <Border.Background>
        <SolidColorBrush Color="{Binding}" />
      </Border.Background>
    </Border>
  </DataTemplate>
  <DataTemplate x:Key="GradientColorBottomDataTemplate">
    <Border BorderBrush="{StaticResource RibbonTopBorderBrush}" BorderThickness="1,0,1,1">
      <Border.Background>
        <SolidColorBrush Color="{Binding}" />
      </Border.Background>
    </Border>
  </DataTemplate>
  <Style x:Key="ColorGalleryGradientListBox" TargetType="{x:Type ListBox}">
    <Setter Property="Background" Value="{StaticResource GalleryBackgroundBrush}" />
    <Setter Property="ItemTemplateSelector" Value="{StaticResource ColorGradientItemTemplateSelect}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListBox}">
          <Border Background="{TemplateBinding Background}" HorizontalAlignment="Stretch">
            <UniformGrid HorizontalAlignment="Left" IsItemsHost="True" Columns="{Binding Columns, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}}" />
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemContainerStyle">
      <Setter.Value>
        <Style TargetType="{x:Type ListBoxItem}">
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type ListBoxItem}">
                <Grid Background="Transparent">
                  <ContentPresenter Margin="2,0,2,0" Width="{Binding ChipWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}, FallbackValue=13}" Height="{Binding ChipHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}, FallbackValue=13}" />
                  <Border BorderThickness="1" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" x:Name="hoverBorder" Visibility="Collapsed" Margin="2,0,2,0">
                    <Border BorderThickness="1" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" />
                  </Border>
                  <Border BorderThickness="1" BorderBrush="{StaticResource ButtonPressedOuterBorderBrush}" x:Name="selectedBorder" Visibility="Collapsed" Margin="2,0,2,0">
                    <Border BorderThickness="1" BorderBrush="{StaticResource ButtonPressedInnerBorderBrush}" />
                  </Border>
                </Grid>
                <ControlTemplate.Triggers>
                  <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Visibility" Value="Visible" TargetName="hoverBorder" />
                  </Trigger>
                  <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Visibility" Value="Visible" TargetName="selectedBorder" />
                  </Trigger>
                </ControlTemplate.Triggers>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
          <Style.Triggers>
            <Trigger Property="Content">
              <Trigger.Value>
                <Color />
              </Trigger.Value>
              <Setter Property="Opacity" Value="0" />
              <Setter Property="IsHitTestVisible" Value="False" />
            </Trigger>
          </Style.Triggers>
        </Style>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="{x:Type Fluent:ColorGallery}">
    <Setter Property="ChipWidth" Value="13" />
    <Setter Property="ChipHeight" Value="13" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:ColorGallery}">
          <StackPanel KeyboardNavigation.DirectionalNavigation="Contained">
            <Fluent:MenuItem x:Name="PART_AutomaticColor" Header="Automatic">
              <Fluent:MenuItem.Icon>
                <Rectangle Width="16" Height="16" Stroke="{StaticResource RibbonTopBorderBrush}" Fill="Black" Margin="-2,0,0,0" />
              </Fluent:MenuItem.Icon>
            </Fluent:MenuItem>
            <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
              <StackPanel Background="{TemplateBinding Background}" ClipToBounds="True" Margin="0,1,0,1" KeyboardNavigation.DirectionalNavigation="Contained">
                <Fluent:GroupSeparatorMenuItem Header="Theme Colors" x:Name="themeColorsSeparator" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_ThemeColorsListBox" ItemsSource="{Binding ThemeColors, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ColorGalleryListBox}" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_ThemeGradientColorsListBox" ItemsSource="{Binding ThemeGradients, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ColorGalleryGradientListBox}" />
                <Fluent:GroupSeparatorMenuItem Header="Standard Colors" x:Name="standardColorsSeparator" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_StandardColorsListBox" ItemsSource="{x:Static Fluent:ColorGallery.StandardThemeColors}" Style="{StaticResource ColorGalleryListBox}" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_StandardGradientColorsListBox" ItemsSource="{Binding StandardGradients, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ColorGalleryGradientListBox}" />
                <Fluent:GroupSeparatorMenuItem Header="Recent Colors" x:Name="recentColorsSeparator" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_RecentColorsListBox" ItemsSource="{x:Static Fluent:ColorGallery.RecentColors}" Style="{StaticResource ColorGalleryListBox}" />
              </StackPanel>
            </ScrollViewer>
            <Fluent:MenuItem x:Name="PART_NoColor" Header="No Color">
              <Fluent:MenuItem.Icon>
                <Rectangle Width="16" Height="16" Stroke="{StaticResource RibbonTopBorderBrush}" Fill="Transparent" Margin="-2,0,0,0" />
              </Fluent:MenuItem.Icon>
            </Fluent:MenuItem>
            <Separator x:Name="separator">
              <Separator.Template>
                <ControlTemplate>
                  <Rectangle Width="Auto" Height="1" Fill="#FFE2E4E7" />
                </ControlTemplate>
              </Separator.Template>
            </Separator>
            <Fluent:MenuItem x:Name="PART_MoreColors" Header="More Colors..." Icon="pack://application:,,,/Fluent;component/Themes/Office2010/Images/MoreColors.png" />
          </StackPanel>
          <ControlTemplate.Triggers>
            <Trigger Property="IsAutomaticColorButtonVisible" Value="False">
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_AutomaticColor" />
            </Trigger>
            <Trigger Property="IsNoColorButtonVisible" Value="False">
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_NoColor" />
            </Trigger>
            <Trigger Property="IsMoreColorsButtonVisible" Value="False">
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_MoreColors" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="separator" />
            </Trigger>
            <Trigger Property="Mode" Value="HighlightColors">
              <Setter Property="ChipWidth" Value="26" />
              <Setter Property="ChipHeight" Value="26" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="themeColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="standardColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="recentColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ThemeColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_RecentColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_StandardGradientColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ThemeGradientColorsListBox" />
              <Setter Property="Columns" Value="5" />
              <Setter Property="Style" Value="{StaticResource HightlightColorGalleryListBox}" TargetName="PART_StandardColorsListBox" />
              <Setter Property="ItemsSource" Value="{x:Static Fluent:ColorGallery.HighlightColors}" TargetName="PART_StandardColorsListBox" />
            </Trigger>
            <Trigger Property="Mode" Value="StandardColors">
              <Setter Property="ChipWidth" Value="20" />
              <Setter Property="ChipHeight" Value="20" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="themeColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="standardColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="recentColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ThemeColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_RecentColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_StandardColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ThemeGradientColorsListBox" />
              <Setter Property="Columns" Value="5" />
              <Setter Property="StandardColorGridRows" Value="6" />
              <Setter Property="ItemsSource" Value="{x:Static Fluent:ColorGallery.StandardColors}" TargetName="PART_StandardGradientColorsListBox" />
            </Trigger>
            <DataTrigger Binding="{Binding ThemeColors.Count, RelativeSource={RelativeSource Self}}" Value="0">
              <Setter Property="Visibility" Value="Collapsed" TargetName="themeColorsSeparator" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Count, Source={x:Static Fluent:ColorGallery.RecentColors}}" Value="0">
              <Setter Property="Visibility" Value="Collapsed" TargetName="recentColorsSeparator" />
            </DataTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="RibbonStatusBarContextMenuItemControlTemplate" TargetType="{x:Type Fluent:StatusBarMenuItem}">
    <Grid Width="Auto" Height="22" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3">
        <Border Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" />
      </Border>
      <TextBlock x:Name="textBlock_Copy" Text="{Binding StatusBarItem.Title, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" Margin="9,3,30,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" Visibility="Hidden" HorizontalAlignment="Left" />
      <TextBlock x:Name="textBlock" Text="{Binding StatusBarItem.Title, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="CharacterEllipsis" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="20" Height="20" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <Image x:Name="iconImage" HorizontalAlignment="Center" Margin="3,2,2,2" VerticalAlignment="Center" Width="Auto" Source="{TemplateBinding Icon}" SnapsToDevicePixels="True" />
      <TextBlock Text="{Binding StatusBarItem.Value, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="3" TextTrimming="CharacterEllipsis" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,4,0" Width="4" Data="M0,0L1,1 0,2z" Height="6" Grid.Column="3">
        <Path.Fill>
          <LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
            <GradientStop Color="Black" Offset="1" />
            <GradientStop Color="#FF828282" />
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="HasItems" Value="False">
        <Setter Property="Visibility" TargetName="path" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <!--<Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5"/>
        <Setter Property="Opacity" TargetName="image" Value="0.5"/>
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5"/>
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect/>
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect/>
          </Setter.Value>
        </Setter>
      </Trigger>-->
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style BasedOn="{StaticResource RibbonStatusBarItemStyle}" TargetType="{x:Type Fluent:StatusBarItem}" />
  <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="true" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Height" Value="14" />
    <Setter Property="Width" Value="14" />
    <Setter Property="Template" Value="{StaticResource SliderThumbControlTemplate}" />
  </Style>
  <Style x:Key="SliderRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="Width" Value="16" />
    <Setter Property="Height" Value="16" />
    <Setter Property="Foreground" Value="White" />
    <Setter Property="Template" Value="{StaticResource SliderRepeatButtonControlTemplate}" />
  </Style>
  <ControlTemplate TargetType="{x:Type Slider}" x:Key="ZoomSliderControlTemplate">
    <Grid Height="16" Width="133">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="16" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="16" />
      </Grid.ColumnDefinitions>
      <Rectangle Grid.ColumnSpan="1" Margin="0,-1,0,0" Stroke="{StaticResource SliderShadowBrush}" VerticalAlignment="Center" Height="1" Grid.Column="1" />
      <!--<Rectangle Grid.ColumnSpan="1" Margin="-1,0,0,0" Stroke="{DynamicResource SliderShadowBrush}" VerticalAlignment="Center" Height="7" Grid.Column="1" Width="1" HorizontalAlignment="Center"/>-->
      <Rectangle Grid.ColumnSpan="1" Margin="0,1,0,0" Stroke="{StaticResource SliderLightenBrush}" VerticalAlignment="Center" Height="1" Grid.Column="1" />
      <Rectangle Grid.ColumnSpan="1" Margin="0,1,0,1" Stroke="{StaticResource SliderLightenBrush}" VerticalAlignment="Center" Height="7" Grid.Column="1" Width="1" HorizontalAlignment="Center" />
      <Rectangle x:Name="rectangle" Grid.ColumnSpan="1" Margin="0" Stroke="{x:Null}" Grid.Column="1" StrokeThickness="0" Fill="#00000000" />
      <Track Grid.Row="0" x:Name="PART_Track" Height="16" Grid.ColumnSpan="1" Grid.Column="1">
        <Track.DecreaseRepeatButton>
          <RepeatButton Style="{StaticResource SliderButtonStyle}" Command="Slider.DecreaseLarge" x:Name="leftButton" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb x:Name="thumb" Style="{StaticResource SliderThumbStyle}" />
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Style="{StaticResource SliderButtonStyle}" Command="Slider.IncreaseLarge" x:Name="rightButton" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton x:Name="repeatButton" d:LayoutOverrides="Width, Height" Style="{StaticResource SliderRepeatButtonStyle}" Command="Slider.DecreaseLarge">
        <Grid Margin="0">
          <Path Data="M0,0L1,0" Fill="{x:Null}" HorizontalAlignment="Center" Margin="0" Stretch="Fill" Width="10" VerticalAlignment="Center" Height="2" StrokeThickness="2" Stroke="White" />
        </Grid>
      </RepeatButton>
      <RepeatButton x:Name="repeatButton_Copy" Style="{StaticResource SliderRepeatButtonStyle}" Grid.Column="2" Command="Slider.IncreaseLarge">
        <Grid Margin="0">
          <Path Data="M0,0L0,1" HorizontalAlignment="Center" Margin="0" Stretch="Fill" Width="2" VerticalAlignment="Center" Height="10" StrokeThickness="2" Stroke="White" />
          <Path Data="M0,0L1,0" HorizontalAlignment="Center" Margin="0" Stretch="Fill" Width="10" VerticalAlignment="Center" Height="2" StrokeThickness="2" Stroke="White" />
        </Grid>
      </RepeatButton>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True" SourceName="leftButton">
        <Setter Property="Background" TargetName="thumb" Value="Red" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True" SourceName="rightButton">
        <Setter Property="Background" TargetName="thumb" Value="Red" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True" SourceName="thumb">
        <Setter Property="Background" TargetName="thumb" Value="Red" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:MetroWindow}" x:Key="MetroWindowStyle">
    <Setter Property="Foreground">
      <Setter.Value>
        <SolidColorBrush Color="{StaticResource BlackColor}" />
      </Setter.Value>
    </Setter>
    <Setter Property="Background">
      <Setter.Value>
        <SolidColorBrush Color="{StaticResource WhiteColor}" />
      </Setter.Value>
    </Setter>
    <Setter Property="Behaviours:StylizedBehaviors.Behaviors">
      <Setter.Value>
        <Behaviours:StylizedBehaviorCollection>
          <Behaviours:BorderlessWindowBehavior />
          <Behaviours:WindowsSettingBehaviour />
        </Behaviours:StylizedBehaviorCollection>
      </Setter.Value>
    </Setter>
    <Setter Property="Template" Value="{StaticResource WindowTemplateKey}" />
  </Style>
  <Style TargetType="{x:Type Fluent:WindowCommands}">
    <Setter Property="Foreground" Value="{StaticResource BlackBrush}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Fluent:WindowCommands">
          <ControlTemplate.Resources>
            <ResourceDictionary>
              <Style TargetType="{x:Type Button}">
                <Setter Property="Background" Value="#02FFFFFF" />
                <Setter Property="HorizontalContentAlignment" Value="Center" />
                <Setter Property="VerticalContentAlignment" Value="Center" />
                <Setter Property="Padding" Value="1" />
                <Setter Property="Template" Value="{StaticResource WindowCommandsControlTemplate}" />
                <Style.Triggers>
                  <DataTrigger Binding="{Binding ShowTitleBar, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Value="True">
                    <Setter Property="Foreground" Value="White" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </ResourceDictionary>
          </ControlTemplate.Resources>
          <StackPanel Orientation="Horizontal" VerticalAlignment="Top">
            <ItemsControl ItemsSource="{Binding Items, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}">
              <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                  <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
              </ItemsControl.ItemsPanel>
            </ItemsControl>
            <Button x:Name="PART_Min" Width="29" Height="{Binding TitlebarHeight, RelativeSource={RelativeSource AncestorType=Fluent:MetroWindow}}" MaxHeight="19" Margin="0,3,0,0" Style="{StaticResource IronicallyNamedChromelessButtonStyle}" Padding="0" ToolTip="{Binding Minimize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" Visibility="{Binding ShowMinButton, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}">
              <Path Data="F1M0,6L0,9 9,9 9,6 0,6z" SnapsToDevicePixels="True" Fill="{StaticResource TabItemFontBrush}" />
            </Button>
            <Button x:Name="PART_Max" Width="29" Height="{Binding TitlebarHeight, RelativeSource={RelativeSource AncestorType=Fluent:MetroWindow}}" MaxHeight="19" Margin="0,3,0,0" Style="{StaticResource IronicallyNamedChromelessButtonStyle}" Padding="0" Foreground="{TemplateBinding Foreground}" Visibility="{Binding ShowMaxRestoreButton, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}" ToolTip="{Binding Maximize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}">
              <Grid>
                <Path x:Name="MaximisePath" SnapsToDevicePixels="True" Data="F1M0,0L0,9 9,9 9,0 0,0 0,3 8,3 8,8 1,8 1,3z" Fill="{StaticResource TabItemFontBrush}" />
                <Path x:Name="RestorePath" SnapsToDevicePixels="True" Data="F1M0,10L0,3 3,3 3,0 10,0 10,2 4,2 4,3 7,3 7,6 6,6 6,5 1,5 1,10z M1,10L7,10 7,7 10,7 10,2 9,2 9,6 6,6 6,9 1,9z" Fill="{StaticResource TabItemFontBrush}" />
              </Grid>
            </Button>
            <Button x:Name="PART_Close" Width="29" Height="{Binding TitlebarHeight, RelativeSource={RelativeSource AncestorType=Fluent:MetroWindow}}" MaxHeight="19" Margin="0,3,0,0" Style="{StaticResource IronicallyNamedChromelessButtonStyle}" ToolTip="{Binding Close, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" Visibility="{Binding ShowCloseButton, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}" Foreground="{TemplateBinding Foreground}">
              <Path Data="F1M0,0L2,0 5,3 8,0 10,0 6,4 10,8 8,8 5,5 2,8 0,8 4,4 0,0z" SnapsToDevicePixels="True" Fill="{StaticResource TabItemFontBrush}" />
            </Button>
          </StackPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <DataTrigger Binding="{Binding ShowTitleBar, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}" Value="True">
        <Setter Property="Foreground" Value="White" />
      </DataTrigger>
    </Style.Triggers>
  </Style>
  <Style BasedOn="{StaticResource MetroWindowStyle}" TargetType="{x:Type Fluent:MetroWindow}" />
  <Style x:Key="{x:Type Fluent:Spinner}" TargetType="Fluent:Spinner" BasedOn="{StaticResource SpinnerStyle}" />
  <Style x:Key="{x:Type Fluent:TwoLineLabel}" TargetType="Fluent:TwoLineLabel" BasedOn="{StaticResource TwoLineLabelStyle}" />
  <Style x:Key="{x:Type Fluent:KeyTip}" TargetType="Fluent:KeyTip" BasedOn="{StaticResource KeyTipStyle}" />
  <Style x:Key="{x:Type Fluent:ScreenTip}" TargetType="{x:Type Fluent:ScreenTip}" BasedOn="{StaticResource ScreenTipStyle}" />
  <Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}" BasedOn="{StaticResource ToolTipStyle}" />
  <Style x:Key="{x:Type Fluent:GalleryGroupContainer}" TargetType="{x:Type Fluent:GalleryGroupContainer}" BasedOn="{StaticResource GalleryGroupContainerStyle}" />
  <Style x:Key="{x:Type Fluent:SeparatorTabItem}" TargetType="{x:Type Fluent:SeparatorTabItem}" BasedOn="{StaticResource SeparatorTabItemStyle}" />
  <Style x:Key="{x:Type Fluent:BackstageTabItem}" TargetType="{x:Type Fluent:BackstageTabItem}" BasedOn="{StaticResource BackstageTabItemStyle}" />
  <Style x:Key="{x:Type Fluent:GalleryItem}" TargetType="{x:Type Fluent:GalleryItem}" BasedOn="{StaticResource GalleryItemStyle}" />
  <Style x:Key="{x:Type Fluent:RibbonContextualTabGroup}" TargetType="{x:Type Fluent:RibbonContextualTabGroup}" BasedOn="{StaticResource RibbonContextualTabGroupStyle}" />
  <Style x:Key="{x:Type Fluent:RibbonTabItem}" TargetType="{x:Type Fluent:RibbonTabItem}" BasedOn="{StaticResource RibbonTabItemStyle}" />
  <Style x:Key="{x:Type Fluent:RibbonToolBar}" TargetType="{x:Type Fluent:RibbonToolBar}" BasedOn="{StaticResource RibbonToolBarStyle}" />
  <ControlTemplate x:Key="RibbonTabControlControlTemplate" TargetType="{x:Type Fluent:RibbonTabControl}">
    <ControlTemplate.Resources>
      <ControlTemplate x:Key="ScrollButtonControlTemplate" TargetType="{x:Type RepeatButton}">
        <Border x:Name="border" BorderThickness="1" BorderBrush="{StaticResource ScrollViewerButtonBorderBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource ScrollViewerButtonBackgroundBrush}">
          <Border x:Name="border1" Height="Auto" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" Background="{StaticResource TransparentBrush}">
            <Grid Height="Auto">
              <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
                <Rectangle.Fill>
                  <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
                    <GradientStop Color="#7FFFFFFF" Offset="0" />
                    <GradientStop Offset="1" />
                  </RadialGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Grid>
          </Border>
        </Border>
        <ControlTemplate.Triggers>
          <Trigger Property="IsMouseOver" Value="False" />
          <Trigger Property="IsPressed" Value="True">
            <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
            <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
            <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonPressedInnerBackgroundBrush}" />
            <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
          </Trigger>
          <Trigger Property="IsEnabled" Value="False" />
          <MultiTrigger>
            <MultiTrigger.Conditions>
              <Condition Property="IsMouseOver" Value="True" />
              <Condition Property="IsPressed" Value="False" />
            </MultiTrigger.Conditions>
            <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
            <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
            <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
            <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
            <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
          </MultiTrigger>
          <MultiTrigger>
            <MultiTrigger.Conditions>
              <Condition Property="IsKeyboardFocusWithin" Value="True" />
              <Condition Property="IsPressed" Value="False" />
            </MultiTrigger.Conditions>
            <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
            <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
            <Setter Property="Background" TargetName="border" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
            <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
          </MultiTrigger>
        </ControlTemplate.Triggers>
      </ControlTemplate>
      <Style x:Key="ScrollButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="Template" Value="{StaticResource ScrollButtonControlTemplate}" />
        <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
      </Style>
      <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="FocusManager.IsFocusScope" Value="False" />
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type ScrollViewer}">
              <Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">
                <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
                <RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Left" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}">
                  <RepeatButton.Visibility>
                    <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                    </MultiBinding>
                  </RepeatButton.Visibility>
                  <Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M0,0L1,1 1,-1z" />
                </RepeatButton>
                <RepeatButton Command="{x:Static ScrollBar.LineRightCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Right" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}">
                  <RepeatButton.Visibility>
                    <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                    </MultiBinding>
                  </RepeatButton.Visibility>
                  <Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M1,0L0,1 0,-1z" />
                </RepeatButton>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
        <Setter Property="CanContentScroll" Value="True" />
        <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
      </Style>
    </ControlTemplate.Resources>
    <Grid x:Name="ContentGrid" Height="Auto" VerticalAlignment="Top">
      <Grid.RowDefinitions>
        <RowDefinition Height="24" />
        <RowDefinition x:Name="rowDefinition" Height="86" />
        <RowDefinition x:Name="rowDefinition1" Height="{TemplateBinding ContentGapHeight}" />
        <!--<RowDefinition x:Name="rowDefinition1"
                                           Height="{TemplateBinding ContentGapHeight}" />-->
      </Grid.RowDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0,-1,0,0" Width="Auto" BorderThickness="0,1" Grid.Row="1" BorderBrush="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" Background="{StaticResource RibbonBackgoundBrush}" />
      <Rectangle Margin="0,-1,0,0" Grid.Row="1" Width="50" Stroke="Black" Height="1" HorizontalAlignment="Left" VerticalAlignment="Top" StrokeThickness="1">
        <Rectangle.OpacityMask>
          <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
            <GradientStop Color="#66000000" Offset="0" />
            <GradientStop Color="Transparent" Offset="1" />
          </LinearGradientBrush>
        </Rectangle.OpacityMask>
      </Rectangle>
      <Rectangle Margin="0,-1,0,0" Grid.Row="1" Width="50" Stroke="Black" Height="1" HorizontalAlignment="Right" VerticalAlignment="Top" StrokeThickness="1">
        <Rectangle.OpacityMask>
          <LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
            <GradientStop Color="#66000000" Offset="0" />
            <GradientStop Color="Transparent" Offset="1" />
          </LinearGradientBrush>
        </Rectangle.OpacityMask>
      </Rectangle>
      <Border HorizontalAlignment="Stretch" Margin="1,0,1,1" Grid.Row="1" Grid.RowSpan="1">
        <ContentControl x:Name="mainContentControl" Margin="0,1,0,0" Focusable="False">
          <ContentPresenter ContentSource="SelectedContent" x:Name="contentPresenter" HorizontalAlignment="Stretch" Margin="0" />
        </ContentControl>
      </Border>
      <Border x:Name="shadowBorder" Margin="0,-1,0,0" VerticalAlignment="Stretch" Width="Auto" Grid.Row="2" Grid.RowSpan="1" BorderThickness="0,1,0,0" BorderBrush="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" Background="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}">
        <Border.OpacityMask>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0.003" />
            <GradientStop Color="#00000000" Offset="0.991" />
            <GradientStop Color="#7F0A0A0A" Offset="0.16" />
            <GradientStop Color="#FF040404" Offset="0.15" />
          </LinearGradientBrush>
        </Border.OpacityMask>
      </Border>
      <Border x:Name="shadowBorder_Copy" Margin="0,-1,0,0" VerticalAlignment="Stretch" Width="Auto" Grid.Row="2" Grid.RowSpan="1" BorderThickness="0,1,0,0" Background="Black" BorderBrush="Black" Opacity="0.3">
        <Border.OpacityMask>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0.003" />
            <GradientStop Color="#00000000" Offset="0.991" />
            <GradientStop Color="#7F0A0A0A" Offset="0.16" />
            <GradientStop Color="#FF040404" Offset="0.15" />
          </LinearGradientBrush>
        </Border.OpacityMask>
      </Border>
      <Grid x:Name="TabsGrid" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Grid.RowSpan="1">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <DockPanel LastChildFill="True">
          <ContentPresenter VerticalAlignment="Top" ContentSource="Menu" DockPanel.Dock="Left" />
          <Fluent:RibbonScrollViewer x:Name="scrollViewer" DockPanel.Dock="Right" HorizontalAlignment="Left" Margin="0,-7,1,0" Width="Auto" Style="{StaticResource RibbonTabScrollViewer}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" IsHitTestVisible="True">
            <!---->
            <Fluent:RibbonTabsContainer x:Name="PART_TabsContainer" IsItemsHost="True" Height="Auto" HorizontalAlignment="Stretch" FocusManager.IsFocusScope="False" Margin="0" />
          </Fluent:RibbonScrollViewer>
        </DockPanel>
        <StackPanel x:Name="toolbarPlaceholder" HorizontalAlignment="Left" Grid.Column="1" Orientation="Horizontal" Margin="0,0,0,1">
          <Grid Width="22" Height="22">
            <Image x:Name="image" Source="/Fluent;Component/Themes/Office2010/Images/RibbonPin.png" Stretch="None" Visibility="Collapsed" />
            <Fluent:ToggleButton x:Name="PART_MinimizeButton" Margin="0" Width="22" Height="22" Size="Small" Style="{StaticResource RibbonTabControlToggleButtonStyle}" IsChecked="{Binding Path=IsMinimized, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Visibility="{TemplateBinding HasItems, Converter={StaticResource boolToVisibilityConverter}}" />
            <!--Visibility="{TemplateBinding HasItems, Converter={StaticResource boolToVisibilityConverter}}"-->
          </Grid>
          <StackPanel x:Name="PART_ToolbarPanel" Orientation="Horizontal" FocusManager.IsFocusScope="False" />
        </StackPanel>
      </Grid>
      <Popup x:Name="PART_Popup" PlacementTarget="{Binding Path=SelectedTabItem,RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" StaysOpen="True" AllowsTransparency="True" PopupAnimation="Slide" VerticalOffset="-1" IsOpen="{TemplateBinding IsDropDownOpen}" HorizontalOffset="0" Placement="Custom">
        <Grid Width="Auto" Height="Auto" Margin="0,20">
          <Grid.RowDefinitions>
            <RowDefinition Height="86" />
            <RowDefinition Height="5" />
          </Grid.RowDefinitions>
          <Border Height="Auto" BorderBrush="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" Background="{StaticResource RibbonBackgoundBrush}" BorderThickness="0,1">
            <ContentControl x:Name="contentControl" Margin="0" />
          </Border>
          <Border Margin="0,-1,0,0" VerticalAlignment="Bottom" Width="Auto" Grid.Row="1" Grid.RowSpan="1" BorderThickness="0,1,0,0" Height="6" BorderBrush="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" Background="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}">
            <Border.OpacityMask>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Black" Offset="0.003" />
                <GradientStop Color="#00000000" Offset="0.991" />
                <GradientStop Color="#7F0A0A0A" Offset="0.16" />
                <GradientStop Color="#FF040404" Offset="0.15" />
              </LinearGradientBrush>
            </Border.OpacityMask>
          </Border>
          <Border Margin="0" VerticalAlignment="Bottom" Width="Auto" Grid.Row="1" Grid.RowSpan="1" BorderThickness="0,1,0,0" Height="6" BorderBrush="Black" Background="Black" Opacity="0.3">
            <Border.OpacityMask>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Black" Offset="0.003" />
                <GradientStop Color="#00000000" Offset="0.991" />
                <GradientStop Color="#7F0A0A0A" Offset="0.16" />
                <GradientStop Color="#FF040404" Offset="0.15" />
              </LinearGradientBrush>
            </Border.OpacityMask>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMinimized" Value="True">
        <Setter Property="Height" TargetName="rowDefinition" Value="0" />
        <Setter Property="Height" TargetName="rowDefinition1" Value="0" />
        <Setter Property="Content" TargetName="mainContentControl" Value="{x:Null}" />
        <Setter Property="Content" TargetName="contentControl" Value="{Binding ElementName=contentPresenter, Mode=OneWay}" />
        <Setter Property="Visibility" TargetName="border" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="shadowBorder" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="image" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsDropDownOpen" Value="True" />
          <Condition Property="IsMinimized" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
        <Setter Property="Opacity" TargetName="PART_MinimizeButton" Value="0" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonGroupBoxDropDownButtonControlTemplate" TargetType="{x:Type Fluent:RibbonGroupBox}">
    <Grid Width="22">
      <Border x:Name="PART_ButtonBorder" BorderThickness="1" CornerRadius="2" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Stretch" d:LayoutOverrides="Width, Height">
        <Border x:Name="border1" Height="Auto" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Background="{StaticResource TransparentBrush}">
          <Grid Height="Auto">
            <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
              <Rectangle.Fill>
                <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
                  <GradientStop Color="#7FFFFFFF" Offset="0" />
                  <GradientStop Offset="1" />
                </RadialGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Vertical" d:LayoutOverrides="Width, Height">
              <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="16" Margin="1,1,0,0" SnapsToDevicePixels="True" />
              <Fluent:TwoLineLabel Visibility="Collapsed" x:Name="controlLabel" Text="{TemplateBinding Header}" Style="{StaticResource TwoLineLabelStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,-2,2,2" />
            </StackPanel>
          </Grid>
        </Border>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Width="Auto" Height="Auto" Margin="0,20">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="5" />
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="5" />
          </Grid.RowDefinitions>
          <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="11,-1,1,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#7F000000" Offset="0" />
                <GradientStop Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,11,0,1" VerticalAlignment="Stretch" Height="Auto" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1.002,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#7F000000" Offset="0" />
                <GradientStop Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,-1,0,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="1" Grid.Row="1" Grid.RowSpan="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="-0.003,0.011" GradientOrigin="-0.003,0.011" RadiusX="1.006" RadiusY="1">
                <GradientStop Color="#7F000000" Offset="0.002" />
                <GradientStop Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,5,0,0" VerticalAlignment="Top" Height="6" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="-0.01,1.004" GradientOrigin="-0.01,1.004" RadiusX="1.006" RadiusY="1">
                <GradientStop Color="#7F000000" Offset="0.002" />
                <GradientStop Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Left" Margin="5,-1,0,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1" Width="6">
            <Rectangle.Fill>
              <RadialGradientBrush Center="1.003,-0.006" GradientOrigin="1.003,-0.006" RadiusX="1.006" RadiusY="1">
                <GradientStop Color="#7F000000" Offset="0.002" />
                <GradientStop Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="border" Height="Auto" Grid.RowSpan="1" Background="{StaticResource RibbonBackgoundBrush}" BorderBrush="{StaticResource RibbonTopBorderBrush}" BorderThickness="1" CornerRadius="1" d:LayoutOverrides="Width">
            <Grid x:Name="PART_ParentPanel" Margin="0,1,0,2" Grid.RowSpan="2" Height="85">
              <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="17" />
              </Grid.RowDefinitions>
              <Grid x:Name="PART_DownGrid" Margin="0,-2,2,2" Grid.Row="1" VerticalAlignment="Bottom" Height="17" MaxWidth="{Binding ActualWidth, ElementName=PART_UpPanel}">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{TemplateBinding Header}" TextWrapping="NoWrap" Grid.Row="1" Foreground="{StaticResource GroupBoxFontBrush}" Margin="2,0" TextTrimming="CharacterEllipsis" TextAlignment="Center" />
                <Fluent:Button Margin="0,0,1,1" x:Name="PART_DialogLauncherButton" HorizontalAlignment="Stretch" Width="15" Height="14" Grid.Column="1" Focusable="False" IsTabStop="False" Template="{StaticResource DialogLauncherButtonControlTemplate}" VerticalAlignment="Bottom" Icon="{TemplateBinding LauncherIcon}" Header="{TemplateBinding LauncherText}" Command="{Binding LauncherCommand, RelativeSource={RelativeSource TemplatedParent}}" CommandTarget="{Binding LauncherCommandTarget, RelativeSource={RelativeSource TemplatedParent}}" CommandParameter="{Binding LauncherCommandParameter, RelativeSource={RelativeSource TemplatedParent}}" ToolTip="{Binding LauncherToolTip, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsLauncherEnabled, RelativeSource={RelativeSource TemplatedParent}}" />
              </Grid>
              <WrapPanel x:Name="PART_UpPanel" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="Auto" Height="Auto" IsItemsHost="True" Margin="2,0,4,0" Orientation="Vertical" FocusManager.IsFocusScope="False" />
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="State" Value="Collapsed">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,0,0" />
        <Setter Property="Margin" TargetName="controlLabel" Value="-2,-1,2,1" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonPressedInnerBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsFocused" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource ButtonHoverInnerBackgroundBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonToggleButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{StaticResource RibbonToggleButtonControlTemplate}" />
    <Setter Property="Height" Value="66" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Style.Triggers>
      <Trigger Property="Fluent:RibbonControl.Size" Value="Large">
        <Setter Property="Height" Value="66" />
      </Trigger>
      <Trigger Property="Fluent:RibbonControl.Size" Value="Middle">
        <Setter Property="Height" Value="22" />
      </Trigger>
      <Trigger Property="Fluent:RibbonControl.Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="22" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="InnerButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{StaticResource InnerButtonControlTemplate}" />
    <Setter Property="VerticalAlignment" Value="Stretch" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <Style x:Key="MenuScrollViewer" TargetType="{x:Type ScrollViewer}">
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="FocusManager.IsFocusScope" Value="False" />
    <Setter Property="Template" Value="{StaticResource MenuScrollViewerControlTemplate}" />
    <Setter Property="CanContentScroll" Value="True" />
    <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <Style x:Key="ScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.GrayTextBrushKey}}" />
      </Trigger>
    </Style.Triggers>
    <Setter Property="Template" Value="{StaticResource ScrollViewerControlTemplate}" />
  </Style>
  <Style x:Key="ToolbarDropDownButtonStyle" TargetType="{x:Type Fluent:DropDownButton}">
    <Setter Property="Template" Value="{StaticResource ToolbarDropDownButtonControlTemplate}" />
    <Setter Property="Height" Value="22" />
    <Setter Property="Width" Value="13" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <ControlTemplate x:Key="MenuItemTemplate" TargetType="{x:Type MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="22" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" Grid.Column="0" Grid.ColumnSpan="3" />
      <TextBlock x:Name="textBlock_Copy" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" d:LayoutOverrides="Width" Visibility="Hidden" HorizontalAlignment="Left" />
      <ContentPresenter x:Name="textBlock" ContentSource="Header" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" RecognizesAccessKey="True" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="20" Height="20" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="16" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      <TextBlock x:Name="gestureTextBlock" Text="{TemplateBinding InputGestureText}" Width="Auto" Height="Auto" Margin="3,3,15,3" VerticalAlignment="Center" Grid.Column="2" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="InputGestureText" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="gestureTextBlock" Value="Collapsed" />
      </Trigger>
      <Trigger Property="InputGestureText" Value="">
        <Setter Property="Visibility" TargetName="gestureTextBlock" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Opacity" TargetName="gestureTextBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HeaderMenuItemTemplate" TargetType="{x:Type MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="22" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" Grid.Column="0" Grid.ColumnSpan="3" />
      <TextBlock x:Name="textBlock_Copy" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" d:LayoutOverrides="Width" Visibility="Hidden" HorizontalAlignment="Left" />
      <ContentPresenter x:Name="textBlock" ContentSource="Header" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" RecognizesAccessKey="True" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="20" Height="20" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="16" Margin="3,2,2,2" SnapsToDevicePixels="True" RecognizesAccessKey="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3">
        <Path.Fill>
          <LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
            <GradientStop Color="#FF7C7C7C" Offset="1" />
            <GradientStop Color="#FF9E9E9E" />
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
      <Popup x:Name="PART_Popup" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0" />
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Data="M0,0L0,1" Grid.RowSpan="2" Visibility="Visible" />
                <ScrollViewer x:Name="PART_ScrollViewer" Style="{StaticResource MenuScrollViewer}" Margin="1" SnapsToDevicePixels="True">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="SplitedMenuItemTemplate" TargetType="{x:Type MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="22" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Rectangle Grid.Column="2" HorizontalAlignment="Right" Margin="0,4,23,4" Stroke="{StaticResource WindowContentBorderBrush}" Width="1" />
      <Grid HorizontalAlignment="Stretch" Margin="0" Width="Auto" Grid.Column="0" Grid.ColumnSpan="3">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="0.905*" />
          <ColumnDefinition x:Name="columnDefinition" Width="23" />
        </Grid.ColumnDefinitions>
        <Border x:Name="PART_ButtonBorder" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" Margin="0,0,-1,0" />
        <Border x:Name="border_Copy" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="1" Background="{StaticResource TransparentBrush}">
          <Border x:Name="border1_Copy" Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:CopyToken="09a4b798-0b8a-441e-b6c8-d7787f8d7e43" Visibility="Collapsed" />
        </Border>
      </Grid>
      <TextBlock x:Name="textBlock_Copy" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" d:LayoutOverrides="Width" Visibility="Hidden" HorizontalAlignment="Left" />
      <ContentPresenter x:Name="textBlock" ContentSource="Header" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" RecognizesAccessKey="True" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="20" Height="20" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{Binding Icon, Converter={StaticResource StringToImageConvert}, RelativeSource={RelativeSource TemplatedParent}}" Width="16" Margin="3,2,2,2" SnapsToDevicePixels="True" RecognizesAccessKey="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3">
        <Path.Fill>
          <LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
            <GradientStop Color="#FF7C7C7C" Offset="1" />
            <GradientStop Color="#FF9E9E9E" />
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
      <Popup x:Name="PART_Popup" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid x:Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0" />
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Data="M0,0L0,1" Grid.RowSpan="2" Visibility="Visible" />
                <ScrollViewer Margin="1" x:Name="PART_ScrollViewer" Style="{StaticResource MenuScrollViewer}" SnapsToDevicePixels="True">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True" SourceName="border_Copy">
        <Setter Property="Visibility" TargetName="border1_Copy" Value="Visible" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="PART_ButtonBorder" Value="Visible" />
        <Setter Property="Visibility" TargetName="border_Copy" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsSubmenuOpen" Value="True">
        <Setter Property="Visibility" TargetName="border1_Copy" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="MenuItemStyle" TargetType="{x:Type MenuItem}">
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Fluent:FrameworkHelper.UseLayoutRounding" Value="True" />
    <Setter Property="Template" Value="{StaticResource MenuItemTemplate}" />
    <Style.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="True" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{StaticResource SplitedMenuItemTemplate}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="False" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{StaticResource HeaderMenuItemTemplate}" />
      </MultiTrigger>
    </Style.Triggers>
  </Style>
  <Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MenuItemStyle}" />
  <Style TargetType="{x:Type Fluent:MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}" />
  <Style x:Key="MenuSeparatorStyle" TargetType="{x:Type Separator}">
    <Setter Property="Template" Value="{StaticResource MenuSeparatorControlTemplate}" />
  </Style>
  <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
    <Setter Property="Template" Value="{StaticResource MenuSeparatorControlTemplate}" />
  </Style>
  <Style TargetType="Fluent:RibbonMenu">
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Fluent:RibbonMenu">
          <ControlTemplate.Resources>
            <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
          </ControlTemplate.Resources>
          <Grid>
            <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" />
            <Fluent:MenuPanel x:Name="menuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Continue" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:Gallery}" x:Key="GalleryControlTemplate">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}" />
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{StaticResource GalleryBorderBrush}" x:Name="layoutRoot">
      <Grid Width="Auto">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <!--<Border x:Name="border" BorderBrush="{x:Null}" BorderThickness="0" Height="13" Background="{DynamicResource GalleryHeaderBackgroundBrush}">
              <Fluent:DropDownButton x:Name="PART_DropDownButton" Style="{StaticResource GalleryDropDownButtonStyle}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Header="{TemplateBinding SelectedFilterTitle}"/>
            </Border>-->
        <ScrollViewer x:Name="scrollViewer" Grid.RowSpan="1" Grid.Row="1" Margin="1" Focusable="False">
          <Fluent:GalleryPanel Background="White" MinItemsInRow="{TemplateBinding MinItemsInRow}" MaxItemsInRow="{TemplateBinding MaxItemsInRow}" Filter="{TemplateBinding SelectedFilterGroups}" ItemContainerGenerator="{Binding ItemContainerGenerator, RelativeSource={RelativeSource TemplatedParent}}" GroupBy="{TemplateBinding GroupBy}" IsItemsHost="True" ItemHeight="{TemplateBinding ItemHeight}" ItemWidth="{TemplateBinding ItemWidth}" Orientation="{TemplateBinding Orientation}" />
        </ScrollViewer>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <!--<Trigger Property="HasFilter" Value="False">
            <Setter Property="Visibility" TargetName="border" Value="Collapsed"/>
          </Trigger>-->
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="GalleryStyle" TargetType="{x:Type Fluent:Gallery}">
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="Template" Value="{StaticResource GalleryControlTemplate}" />
    <Setter Property="Margin" Value="0" />
    <Setter Property="BorderThickness" Value="0,0,0,1" />
    <Style.Triggers>
      <Trigger Property="IsLastItem" Value="True">
        <Setter Property="BorderThickness" Value="0" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <StackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <WrapPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="InRibbonGalleryToggleButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{StaticResource InRibbonGalleryToggleButtonControlTemplate}" />
    <Setter Property="Height" Value="68" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Height" Value="68" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Height" Value="22" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="31" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:InRibbonGallery}" x:Key="InRibbonGalleryControlTemplate">
    <Grid Width="Auto" Height="Auto" x:Name="PART_LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Top">
      <Border Width="Auto" BorderThickness="1,1,1,1" CornerRadius="0,1,1,0" BorderBrush="{StaticResource InRibbonGalleryBorderBrush}" ClipToBounds="True" Margin="0,0,0,0" x:Name="border" Height="60" HorizontalAlignment="Stretch" VerticalAlignment="Top">
        <Grid Width="Auto" Height="Auto">
          <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible">
            <ScrollViewer.Resources>
              <Style TargetType="{x:Type ScrollBar}">
                <Setter Property="Template">
                  <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollBar}">
                      <StackPanel HorizontalAlignment="Right" Margin="0,-1,-1,0">
                        <RepeatButton x:Name="upButton" Width="15" Height="21" Command="ScrollBar.PageUpCommand" Margin="0,0,0,0" Style="{StaticResource InRibbonGalleryRepeatButton}">
                          <Path RenderOptions.EdgeMode="Aliased" Data="M0,0 L1,-1 2,0z" Fill="Black" Width="5" Height="3" Stretch="Fill" />
                        </RepeatButton>
                        <RepeatButton x:Name="downButton" Width="15" Height="21" Command="ScrollBar.PageDownCommand" Margin="0,-1,0,0" Style="{StaticResource InRibbonGalleryRepeatButton}">
                          <Path RenderOptions.EdgeMode="Aliased" Data="M0,0 L1,1 2,0z" Fill="Black" Width="5" Height="3" Stretch="Fill" />
                        </RepeatButton>
                      </StackPanel>
                    </ControlTemplate>
                  </Setter.Value>
                </Setter>
                <Setter Property="ContextMenu" Value="{x:Null}" />
              </Style>
            </ScrollViewer.Resources>
            <Grid>
              <ContentControl x:Name="PART_ContentPresenter" Focusable="False">
                <Fluent:GalleryPanel x:Name="PART_GalleryPanel" Background="White" ItemContainerGenerator="{Binding ItemContainerGenerator, RelativeSource={RelativeSource TemplatedParent}}" IsItemsHost="True" ItemHeight="{TemplateBinding ItemHeight}" ItemWidth="{TemplateBinding ItemWidth}" Orientation="{TemplateBinding Orientation}" Filter="{TemplateBinding SelectedFilterGroups}" GroupBy="{TemplateBinding GroupBy}" IsGrouped="False" />
              </ContentControl>
              <Image x:Name="PART_FakeImage" Visibility="Collapsed" />
            </Grid>
          </ScrollViewer>
          <Fluent:ToggleButton IsDefinitive="False" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="15" Height="20" x:Name="PART_ExpandButton" Style="{StaticResource InRibbonGalleryButton}" Margin="0,0,-1,-1" ClickMode="Press" CanAddToQuickAccessToolBar="False" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource = {RelativeSource TemplatedParent}}" />
          <Popup x:Name="PART_Popup" Placement="Relative" PlacementTarget="{Binding ElementName=PART_LayoutRoot}" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
            <Popup.Resources>
              <ResourceDictionary>
                <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
              </ResourceDictionary>
            </Popup.Resources>
            <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
              <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="10" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="10" />
              </Grid.ColumnDefinitions>
              <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
                <Rectangle.Fill>
                  <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                    <GradientStop Color="#3F000000" Offset="0" />
                    <GradientStop Color="#00000000" Offset="1" />
                  </RadialGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
                <Rectangle.Fill>
                  <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                    <GradientStop Color="#3F000000" Offset="0" />
                    <GradientStop Color="#00000000" Offset="1" />
                  </RadialGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
                <Rectangle.Fill>
                  <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                    <GradientStop Color="#3F000000" Offset="0" />
                    <GradientStop Color="#00000000" Offset="1" />
                  </RadialGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
                <Rectangle.Fill>
                  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                    <GradientStop Color="#3F000000" Offset="0" />
                    <GradientStop Color="#00000000" Offset="1" />
                  </LinearGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
                <Rectangle.Fill>
                  <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                    <GradientStop Color="#3F000000" Offset="0" />
                    <GradientStop Color="#00000000" Offset="1" />
                  </LinearGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Border x:Name="PART_DropDownBorder" MinWidth="{Binding ActualWidth, ElementName=PART_LayoutRoot}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" KeyboardNavigation.DirectionalNavigation="Cycle">
                  <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
                  <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                    <Grid.RowDefinitions>
                      <RowDefinition Height="*" />
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                    <Grid x:Name="PART_MenuPanel" MinWidth="{Binding MinWidth, ElementName=PART_DropDownBorder}" MaxHeight="{TemplateBinding MaxDropDownHeight}" VerticalAlignment="Top">
                      <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                      </Grid.RowDefinitions>
                      <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{StaticResource GalleryBorderBrush}" x:Name="layoutRoot">
                        <Grid Width="Auto">
                          <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                          </Grid.RowDefinitions>
                          <Border Grid.Row="0" x:Name="border_" BorderBrush="{x:Null}" BorderThickness="0" Height="13" Background="{StaticResource GalleryHeaderBackgroundBrush}">
                            <Fluent:DropDownButton x:Name="PART_FilterDropDownButton" Style="{StaticResource GalleryDropDownButtonStyle}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Header="{TemplateBinding SelectedFilterTitle}" />
                          </Border>
                          <ScrollViewer x:Name="PART_ScrollViewer" Grid.Row="1" MinHeight="{Binding ActualHeight, ElementName=PART_LayoutRoot}" BorderBrush="{StaticResource GalleryBorderBrush}" BorderThickness="0,0,0,1" Margin="1">
                            <ContentControl x:Name="PART_PopupContentPresenter" Content="{x:Null}" />
                          </ScrollViewer>
                        </Grid>
                      </Border>
                      <ContentPresenter x:Name="menuPresenter" ContentSource="Menu" Grid.Row="1" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Top" />
                    </Grid>
                    <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="2" CornerRadius="0,0,1,1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                      <Grid>
                        <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                        <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                      </Grid>
                    </Border>
                  </Grid>
                </Grid>
              </Border>
            </Grid>
          </Popup>
        </Grid>
      </Border>
      <Fluent:ToggleButton IsDefinitive="False" Margin="0,0,0,0" Visibility="Collapsed" x:Name="PART_DropDownButton" Icon="{Binding Path=Icon, RelativeSource={RelativeSource TemplatedParent}}" LargeIcon="{Binding Path=LargeIcon, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Path=Header, RelativeSource={RelativeSource TemplatedParent}}" Size="{Binding Path=Size, RelativeSource={RelativeSource TemplatedParent}}" SizeDefinition="{Binding Path=SizeDefinition, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource InRibbonGalleryToggleButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top" ClickMode="Press" CanAddToQuickAccessToolBar="False" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="HasFilter" Value="False">
        <Setter Property="Visibility" TargetName="border_" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="IsEnabled" TargetName="PART_DropDownButton" Value="False" />
        <Setter Property="IsEnabled" TargetName="PART_ExpandButton" Value="False" />
      </Trigger>
      <Trigger Property="IsCollapsed" Value="True">
        <Setter Property="Visibility" TargetName="border" Value="Collapsed" />
        <Setter Property="Placement" TargetName="PART_Popup" Value="Bottom" />
        <Setter Property="Visibility" TargetName="PART_DropDownButton" Value="Visible" />
        <Setter Property="VerticalAlignment" TargetName="PART_LayoutRoot" Value="Top" />
        <Setter Property="HorizontalAlignment" TargetName="PART_LayoutRoot" Value="Left" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <!--<Setter Property="Content" TargetName="contentPresenter" Value="{x:Null}"/>
              <Setter Property="Content" TargetName="popupContentPresenter" Value="{Binding ElementName=PART_GalleryPanel}"/>                            
              <Setter Property="IsGrouped" TargetName="PART_GalleryPanel" Value="True"/>              -->
        <!--<Setter Property="IsHitTestVisible" TargetName="PART_DropDownButton" Value="False"/>-->
      </Trigger>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Menu" Value="{x:Null}">
        <Setter Property="BorderThickness" TargetName="PART_ScrollViewer" Value="0" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="{x:Type Fluent:InRibbonGallery}" TargetType="{x:Type Fluent:InRibbonGallery}">
    <Style.Triggers>
      <Trigger Property="IsCollapsed" Value="True">
        <Setter Property="Margin" Value="0" />
      </Trigger>
    </Style.Triggers>
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Template" Value="{StaticResource InRibbonGalleryControlTemplate}" />
    <Setter Property="Margin" Value="2,3,3,0" />
  </Style>
  <Style TargetType="{x:Type Fluent:Button}" x:Key="ButtonBackstageStyle">
    <Setter Property="Template" Value="{StaticResource ButtonBackstageControlTemplate}" />
    <Setter Property="Height" Value="81" />
    <Setter Property="Width" Value="85" />
  </Style>
  <Style TargetType="{x:Type Fluent:ToggleButton}" x:Key="ToggleButtonBackstageStyle">
    <Setter Property="Template" Value="{StaticResource ToggleButtonBackstageControlTemplate}" />
    <Setter Property="Height" Value="81" />
    <Setter Property="Width" Value="85" />
  </Style>
  <Style TargetType="{x:Type Fluent:DropDownButton}" x:Key="DropDownButtonBackstageStyle">
    <Setter Property="Template" Value="{StaticResource DropDownButtonBackstageControlTemplate}" />
    <Setter Property="Height" Value="81" />
    <Setter Property="Width" Value="85" />
  </Style>
  <ControlTemplate x:Key="ComboBoxBackstageControlTemplate" TargetType="{x:Type Fluent:ComboBox}">
    <ControlTemplate.Resources>
      <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
      <Style x:Key="{x:Type Fluent:ToggleButton}" TargetType="{x:Type Fluent:ToggleButton}" BasedOn="{StaticResource ToggleButtonBackstageStyle}" />
      <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}" />
      <Style x:Key="{x:Type ComboBoxItem}" TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource MetroComboBoxItemBackstageStyle}" />
    </ControlTemplate.Resources>
    <Grid>
      <Border Height="Auto" x:Name="PART_ContentBorder" HorizontalAlignment="Stretch">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="22" />
          </Grid.ColumnDefinitions>
          <Fluent:ToggleButton Size="Small" Width="{Binding ElementName=PART_ContentBorder, Path=ActualWidth}" IsDefinitive="False" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="2" Margin="0" CanAddToQuickAccessToolBar="False" />
          <ContentPresenter Margin="3" x:Name="PART_ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" VerticalAlignment="Top" HorizontalAlignment="Left" />
          <Image Margin="0" Stretch="None" x:Name="PART_SelectedImage" IsHitTestVisible="False" VerticalAlignment="Top" HorizontalAlignment="Left" Visibility="Collapsed" Width="Auto" Height="Auto" />
          <TextBox Focusable="True" x:Name="PART_EditableTextBox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextWrapping="NoWrap" BorderThickness="0,0,0,0" IsReadOnly="{TemplateBinding IsReadOnly}" Background="{StaticResource TextBoxBackgroundBrush}" Visibility="Collapsed" />
          <Path x:Name="path" HorizontalAlignment="Center" Margin="0,0,0,0" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" Data="M0,0L1,1 2,0z" Fill="#FF000000" Width="7" Height="4" VerticalAlignment="Center" Grid.Column="1" />
        </Grid>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" PlacementTarget="{Binding ElementName=PART_ContentBorder}" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Popup.Resources>
          <ResourceDictionary>
            <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
          </ResourceDictionary>
        </Popup.Resources>
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Border x:Name="PART_DropDownBorder" MinWidth="{Binding ActualWidth, ElementName=PART_ContentBorder}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" KeyboardNavigation.DirectionalNavigation="Cycle">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                <Grid x:Name="PART_MenuPanel" MaxHeight="{TemplateBinding MaxDropDownHeight}" VerticalAlignment="Top">
                  <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                  </Grid.RowDefinitions>
                  <ScrollViewer Grid.Row="0" Focusable="False" BorderBrush="{StaticResource GalleryBorderBrush}" x:Name="PART_ScrollViewer" Margin="1" SnapsToDevicePixels="True" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Stretch" VerticalScrollBarVisibility="Visible" BorderThickness="0,0,0,1">
                    <Fluent:GalleryPanel Background="White" x:Name="PART_GalleryPanel" ItemContainerGenerator="{Binding ItemContainerGenerator, RelativeSource={RelativeSource TemplatedParent}}" GroupBy="{TemplateBinding GroupBy}" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="None" ItemHeight="{TemplateBinding ItemHeight}" Orientation="Vertical" />
                    <!--<StackPanel Background="White" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="None" Orientation="Vertical"/>-->
                  </ScrollViewer>
                  <ContentPresenter Grid.Row="1" x:Name="menuPresenter" ContentSource="Menu" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Top" />
                </Grid>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="2" CornerRadius="0,0,1,1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="#FFC8C8C9" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonToolBarControlGroupStyle" TargetType="{x:Type Fluent:RibbonToolBarControlGroup}">
    <Setter Property="Template" Value="{StaticResource RibbonToolBarControlGroupTemplate}" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <Style x:Key="RibbonComboButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{StaticResource RibbonComboButtonControlTemplate}" />
    <Setter Property="Height" Value="66" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:ComboBox}" x:Key="ComboboxControlTemplate">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Border Width="Auto" Background="#00000000" Height="22">
      <Grid Width="Auto" Height="Auto" Background="#00000000">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="stackPanel" HorizontalAlignment="Stretch" Margin="0,0,4,0">
          <ContentPresenter x:Name="iconImage" Width="16" Height="16" VerticalAlignment="Center" Margin="3,0,0,0" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
          <TextBlock Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,0,0" x:Name="textBlock" />
        </StackPanel>
        <Border Height="Auto" BorderThickness="1,1,1,1" BorderBrush="{StaticResource TextBoxBorderBrush}" x:Name="PART_ContentBorder" Background="{StaticResource TextBoxBackgroundBrush}" Grid.Column="1" Grid.ColumnSpan="1" Width="{TemplateBinding InputWidth}" d:LayoutOverrides="GridBox" HorizontalAlignment="Right">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="13" />
            </Grid.ColumnDefinitions>
            <Border Grid.ColumnSpan="1" Grid.Column="1" BorderThickness="1,0,0,0" BorderBrush="{StaticResource TextBoxHoverBorderBrush}" Visibility="Collapsed" x:Name="border1" Background="{StaticResource TextBoxBackgroundBrush}" />
            <Fluent:ToggleButton IsDefinitive="False" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press" Height="Auto" VerticalAlignment="Stretch" Grid.ColumnSpan="2" Margin="0,-1,-1,-1" Style="{StaticResource RibbonComboButtonStyle}" CanAddToQuickAccessToolBar="False" />
            <ContentPresenter Margin="3" x:Name="PART_ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" VerticalAlignment="Top" HorizontalAlignment="Left" />
            <Image Margin="0" Stretch="None" x:Name="PART_SelectedImage" IsHitTestVisible="False" VerticalAlignment="Top" HorizontalAlignment="Left" Visibility="Collapsed" Width="Auto" Height="Auto" />
            <TextBox Focusable="True" x:Name="PART_EditableTextBox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextWrapping="NoWrap" BorderThickness="0,0,0,0" IsReadOnly="{TemplateBinding IsReadOnly}" Background="{StaticResource TextBoxBackgroundBrush}" Visibility="Hidden" />
          </Grid>
        </Border>
        <Popup x:Name="PART_Popup" Placement="Bottom" PlacementTarget="{Binding ElementName=PART_ContentBorder}" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
          <Popup.Resources>
            <ResourceDictionary>
              <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
            </ResourceDictionary>
          </Popup.Resources>
          <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="4" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="4" />
            </Grid.ColumnDefinitions>
            <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
              <Rectangle.Fill>
                <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                  <GradientStop Color="#3F000000" Offset="0" />
                  <GradientStop Color="#00000000" Offset="1" />
                </RadialGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
              <Rectangle.Fill>
                <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                  <GradientStop Color="#3F000000" Offset="0" />
                  <GradientStop Color="#00000000" Offset="1" />
                </RadialGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
              <Rectangle.Fill>
                <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                  <GradientStop Color="#3F000000" Offset="0" />
                  <GradientStop Color="#00000000" Offset="1" />
                </RadialGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
              <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                  <GradientStop Color="#3F000000" Offset="0" />
                  <GradientStop Color="#00000000" Offset="1" />
                </LinearGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
              <Rectangle.Fill>
                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                  <GradientStop Color="#3F000000" Offset="0" />
                  <GradientStop Color="#00000000" Offset="1" />
                </LinearGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            <Border x:Name="PART_DropDownBorder" Margin="0" MinWidth="{Binding ActualWidth, ElementName=PART_ContentBorder}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" KeyboardNavigation.DirectionalNavigation="Cycle">
                <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
                <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                  </Grid.RowDefinitions>
                  <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="3" Visibility="Visible" VerticalAlignment="Stretch" />
                  <ContentControl x:Name="upResizeContent" />
                  <Grid Grid.Row="1" x:Name="PART_MenuPanel" MaxHeight="{TemplateBinding MaxDropDownHeight}" VerticalAlignment="Top">
                    <Grid.RowDefinitions>
                      <RowDefinition Height="*" />
                      <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <ScrollViewer Focusable="False" BorderBrush="{StaticResource GalleryBorderBrush}" x:Name="PART_ScrollViewer" Margin="1" SnapsToDevicePixels="True" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Stretch" BorderThickness="0,0,0,1">
                      <Fluent:GalleryPanel x:Name="PART_GalleryPanel" Background="White" ItemContainerGenerator="{Binding ItemContainerGenerator, RelativeSource={RelativeSource TemplatedParent}}" GroupBy="{TemplateBinding GroupBy}" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="None" ItemHeight="{TemplateBinding ItemHeight}" Orientation="Vertical" />
                      <!--<StackPanel Background="White" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="None" Orientation="Vertical"/>-->
                    </ScrollViewer>
                    <ContentPresenter x:Name="menuPresenter" ContentSource="Menu" Grid.Row="1" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Top" />
                  </Grid>
                  <ContentControl x:Name="downResizeContent" Grid.Row="2">
                    <Border RenderTransformOrigin="0.5, 0.5" x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" CornerRadius="0,0,1,1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                      <Grid>
                        <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                        <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                      </Grid>
                    </Border>
                  </ContentControl>
                </Grid>
              </Grid>
            </Border>
          </Grid>
        </Popup>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="ShowPopupOnTop" Value="True">
        <Setter Property="Content" TargetName="downResizeContent" Value="{x:Null}" />
        <Setter Property="Content" TargetName="upResizeContent" Value="{Binding ElementName=resizeBorder}" />
        <Setter Property="CornerRadius" TargetName="resizeBorder" Value="1,1,0,0" />
        <Setter Property="Cursor" TargetName="PART_ResizeBothThumb" Value="SizeNESW" />
        <Setter Property="LayoutTransform" TargetName="PART_ResizeBothThumb">
          <Setter.Value>
            <ScaleTransform ScaleX="1" ScaleY="-1" />
          </Setter.Value>
        </Setter>
        <Setter Property="LayoutTransform" TargetName="PART_ResizeVerticalThumb">
          <Setter.Value>
            <ScaleTransform ScaleX="1" ScaleY="-1" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Menu" Value="{x:Null}">
        <Setter Property="BorderThickness" TargetName="PART_ScrollViewer" Value="0" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Icon" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
      </Trigger>
      <Trigger Property="InputWidth" Value="NaN">
        <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Visibility" TargetName="textBlock" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Visibility" TargetName="stackPanel" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="IsEnabled" TargetName="PART_EditableTextBox" Value="False" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxDisabledBorderBrush}" />
        <Setter Property="BorderBrush" TargetName="border1" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_EditableTextBox" Value="{StaticResource TextBoxDisabledBackgroundBrush}" />
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Visibility" TargetName="border1" Value="Visible" />
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxHoverBorderBrush}" />
        <Setter Property="Background" TargetName="PART_EditableTextBox" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsKeyboardFocusWithin" Value="True">
        <Setter Property="Visibility" TargetName="border1" Value="Visible" />
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxHoverBorderBrush}" />
        <Setter Property="Background" TargetName="PART_EditableTextBox" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
        <Setter Property="Background" TargetName="border1" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{StaticResource TextBoxHoverBackgroundBrush}" />
      </Trigger>
      <Trigger Property="HasItems" Value="false">
        <Setter TargetName="PART_DropDownBorder" Property="MinHeight" Value="95" />
      </Trigger>
      <Trigger Property="IsGrouping" Value="true">
        <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
      </Trigger>
      <Trigger Property="IsEditable" Value="true">
        <Setter Property="IsTabStop" Value="false" />
        <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
        <Setter TargetName="PART_ContentSite" Property="Visibility" Value="Hidden" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:ComboBox}">
    <Setter Property="Template" Value="{StaticResource ComboboxControlTemplate}" />
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Visible" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
    <Setter Property="MaxDropDownHeight" Value="{x:Static System:Double.PositiveInfinity}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="IsEditable" Value="True" />
    <!--<Setter Property="ItemContainerStyle" Value="{DynamicResource EditableComboBoxItemStyle}"/>-->
    <Style.Triggers>
      <!--<Trigger Property="IsEditable" Value="False">
        <Setter Property="ItemContainerStyle" Value="{DynamicResource NonEditableComboBoxItemStyle}"/>
      </Trigger>-->
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="ItemContainerStyleSelector" Value="{x:Null}" />
          <Condition Property="IsEditable" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="ItemContainerStyle" Value="{StaticResource EditableComboBoxItemStyle}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="ItemContainerStyleSelector" Value="{x:Null}" />
          <Condition Property="IsEditable" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="ItemContainerStyle" Value="{StaticResource NonEditableComboBoxItemStyle}" />
      </MultiTrigger>
    </Style.Triggers>
  </Style>
  <Style TargetType="{x:Type Fluent:StatusBarMenuItem}">
    <Setter Property="Template" Value="{StaticResource RibbonStatusBarContextMenuItemControlTemplate}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="IsCheckable" Value="True" />
    <Setter Property="IsChecked" Value="{Binding StatusBarItem.IsChecked, RelativeSource={RelativeSource Self}, Mode=TwoWay}" />
  </Style>
  <Style x:Key="ZoomSliderStyle" TargetType="{x:Type Slider}">
    <Setter Property="Template" Value="{StaticResource ZoomSliderControlTemplate}" />
    <Setter Property="Width" Value="133" />
    <Setter Property="Height" Value="16" />
    <Setter Property="Maximum" Value="500" />
    <Setter Property="Minimum" Value="10" />
    <Setter Property="SmallChange" Value="1" />
    <Setter Property="LargeChange" Value="10" />
    <Setter Property="Value" Value="100" />
  </Style>
  <Style x:Key="{x:Type Fluent:ToggleButton}" TargetType="{x:Type Fluent:ToggleButton}" BasedOn="{StaticResource RibbonToggleButtonStyle}" />
  <Style x:Key="{x:Type Fluent:Gallery}" TargetType="{x:Type Fluent:Gallery}" BasedOn="{StaticResource GalleryStyle}" />
  <Style x:Key="{x:Type Fluent:RibbonToolBarControlGroup}" TargetType="{x:Type Fluent:RibbonToolBarControlGroup}" BasedOn="{StaticResource RibbonToolBarControlGroupStyle}" />
  <ControlTemplate x:Key="ApplicationMenuSecondLevelItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="53" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3">
        <Border Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" />
      </Border>
      <TextBlock x:Name="textBlock_Copy" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" Visibility="Hidden" HorizontalAlignment="Left" />
      <TextBlock x:Name="textBlock" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <TextBlock x:Name="textBlockDesc" Text="{TemplateBinding Description}" Width="Auto" HorizontalAlignment="Stretch" Height="Auto" Margin="9,22,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextWrapping="Wrap" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,4,0,0" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Top" Margin="3,4,2,2" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" SnapsToDevicePixels="True" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HeaderApplicationMenuSecondLevelItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
        <Style x:Key="{x:Type Fluent:MenuItem}" TargetType="{x:Type Fluent:MenuItem}" BasedOn="{StaticResource MenuItemStyle}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="53" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3">
        <Border Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" />
      </Border>
      <TextBlock x:Name="textBlock_Copy" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" Visibility="Hidden" HorizontalAlignment="Left" />
      <TextBlock x:Name="textBlock" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <TextBlock x:Name="textBlockDesc" Text="{TemplateBinding Description}" Width="Auto" HorizontalAlignment="Stretch" Height="Auto" Margin="9,22,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextWrapping="Wrap" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,4,0,0" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Top" Margin="3,4,2,2" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3">
        <Path.Fill>
          <LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
            <GradientStop Color="#FF7C7C7C" Offset="1" />
            <GradientStop Color="#FF9E9E9E" />
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
      <Popup x:Name="PART_Popup" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade" Margin="0,0,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="4" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="4" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="2,2,1,1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Data="M0,0L0,1" Grid.RowSpan="2" Visibility="Visible" />
                <ScrollViewer VerticalScrollBarVisibility="Auto" x:Name="PART_ScrollViewer" Margin="1" SnapsToDevicePixels="True">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="SplitedApplicationMenuSecondLevelItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
        <Style x:Key="{x:Type Fluent:MenuItem}" TargetType="{x:Type Fluent:MenuItem}" BasedOn="{StaticResource MenuItemStyle}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="53" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Rectangle Grid.Column="2" HorizontalAlignment="Right" Margin="0,4,23,4" Stroke="{StaticResource WindowContentBorderBrush}" Width="1" />
      <Grid HorizontalAlignment="Stretch" Margin="0" Width="Auto" Grid.Column="0" Grid.ColumnSpan="3">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="0.905*" />
          <ColumnDefinition x:Name="columnDefinition" Width="23" />
        </Grid.ColumnDefinitions>
        <Border x:Name="PART_ButtonBorder" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Margin="0,0,-1,0">
          <Border x:Name="border1" Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="2" />
        </Border>
        <Border x:Name="border_Copy" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="1" Background="{StaticResource TransparentBrush}">
          <Border x:Name="border1_Copy" Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:CopyToken="09a4b798-0b8a-441e-b6c8-d7787f8d7e43" Visibility="Collapsed" />
        </Border>
      </Grid>
      <TextBlock x:Name="textBlock_Copy" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" Visibility="Hidden" HorizontalAlignment="Left" />
      <TextBlock x:Name="textBlock" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <TextBlock x:Name="textBlockDesc" Text="{TemplateBinding Description}" Width="Auto" HorizontalAlignment="Stretch" Height="Auto" Margin="9,22,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextWrapping="Wrap" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,4,0,0" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Top" Margin="3,4,2,2" Content="{Binding Icon, Converter={StaticResource StringToImageConvert}, RelativeSource={RelativeSource TemplatedParent}}" Width="32" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3">
        <Path.Fill>
          <LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
            <GradientStop Color="#FF7C7C7C" Offset="1" />
            <GradientStop Color="#FF9E9E9E" />
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
      <Popup x:Name="PART_Popup" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid x:Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Data="M0,0L0,1" Grid.RowSpan="2" Visibility="Visible" />
                <ScrollViewer Margin="1" x:Name="PART_ScrollViewer" Style="{StaticResource MenuScrollViewer}" SnapsToDevicePixels="True">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True" SourceName="border_Copy">
        <Setter Property="Visibility" TargetName="border1_Copy" Value="Visible" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="PART_ButtonBorder" Value="Visible" />
        <Setter Property="Visibility" TargetName="border_Copy" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsSubmenuOpen" Value="True">
        <Setter Property="Visibility" TargetName="border1_Copy" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ApplicationMenuSecondLevelStyle" TargetType="{x:Type Fluent:MenuItem}">
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="ResizeMode" Value="None" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Fluent:FrameworkHelper.UseLayoutRounding" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template" Value="{StaticResource ApplicationMenuSecondLevelItemTemplate}" />
    <Style.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="True" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{StaticResource SplitedApplicationMenuSecondLevelItemTemplate}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="False" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{StaticResource HeaderApplicationMenuSecondLevelItemTemplate}" />
      </MultiTrigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="ApplicationMenuItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="44" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3">
        <Border Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" />
      </Border>
      <TextBlock x:Name="textBlock_Copy" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" Visibility="Hidden" HorizontalAlignment="Left" />
      <TextBlock x:Name="textBlock" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" Margin="3,2,2,2" SnapsToDevicePixels="True" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HeaderApplicationMenuItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
        <Style x:Key="{x:Type Fluent:MenuItem}" TargetType="{x:Type Fluent:MenuItem}" BasedOn="{StaticResource ApplicationMenuSecondLevelStyle}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="44" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3">
        <Border Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" />
      </Border>
      <TextBlock x:Name="textBlock_Copy" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" d:LayoutOverrides="Width" Visibility="Hidden" HorizontalAlignment="Left" />
      <TextBlock x:Name="textBlock" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3">
        <Path.Fill>
          <LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
            <GradientStop Color="#FF7C7C7C" Offset="1" />
            <GradientStop Color="#FF9E9E9E" />
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
      <Popup x:Name="PART_Popup" Placement="Relative" PlacementTarget="{Binding Converter={StaticResource ApplicationMenuRightContentExtractorConvert}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ApplicationMenu}}}" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade" Margin="0,0,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="{Binding RightPaneWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ApplicationMenu}}}" Height="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MenuPanel}}}">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="4" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="4" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="2,2,1,1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PART_ScrollViewer" Margin="1" SnapsToDevicePixels="True">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="SplitedApplicationMenuItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
        <Style TargetType="{x:Type Fluent:MenuItem}" BasedOn="{StaticResource ApplicationMenuSecondLevelStyle}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="44" Background="#00000000">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Rectangle Grid.Column="2" HorizontalAlignment="Right" Margin="0,4,23,4" Stroke="{StaticResource WindowContentBorderBrush}" Width="1" />
      <Grid HorizontalAlignment="Stretch" Margin="0" Width="Auto" Grid.Column="0" Grid.ColumnSpan="3">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="0.905*" />
          <ColumnDefinition x:Name="columnDefinition" Width="23" />
        </Grid.ColumnDefinitions>
        <Border x:Name="PART_ButtonBorder" Visibility="Collapsed" Background="{StaticResource ButtonHoverOuterBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Margin="0,0,-1,0">
          <Border x:Name="border1" Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="2" />
        </Border>
        <Border x:Name="border_Copy" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" BorderBrush="{StaticResource ButtonHoverOuterBorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="1" Background="{StaticResource TransparentBrush}">
          <Border x:Name="border1_Copy" Background="{StaticResource ButtonHoverInnerBackgroundBrush}" BorderBrush="{StaticResource ButtonHoverInnerBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:CopyToken="09a4b798-0b8a-441e-b6c8-d7787f8d7e43" Visibility="Collapsed" />
        </Border>
      </Grid>
      <TextBlock x:Name="textBlock_Copy" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,13,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="None" d:LayoutOverrides="Width" Visibility="Hidden" HorizontalAlignment="Left" />
      <TextBlock x:Name="textBlock" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <Rectangle x:Name="rectangle" Fill="{StaticResource MenuItemCheckBoxBackgroundBrush}" Stroke="{StaticResource MenuItemCheckBoxBorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Source="/Fluent;Component/Themes/Office2010/Images/Checked.png" Stretch="None" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding Icon, Converter={StaticResource StringToImageConvert}, RelativeSource={RelativeSource TemplatedParent}}" Width="32" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3">
        <Path.Fill>
          <LinearGradientBrush EndPoint="0.945,0.872" StartPoint="0.055,0.128">
            <GradientStop Color="#FF7C7C7C" Offset="1" />
            <GradientStop Color="#FF9E9E9E" />
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
      <Popup x:Name="PART_Popup" Placement="Relative" PlacementTarget="{Binding Converter={StaticResource ApplicationMenuRightContentExtractorConvert}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ApplicationMenu}}}" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade" Margin="0,0,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="{Binding RightPaneWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ApplicationMenu}}}" Height="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MenuPanel}}}">
        <Grid x:Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="4" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="4" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Data="M0,0L0,1" Grid.RowSpan="2" Visibility="Visible" />
                <ScrollViewer Margin="1" x:Name="PART_ScrollViewer" Style="{StaticResource MenuScrollViewer}" SnapsToDevicePixels="True">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True" SourceName="border_Copy">
        <Setter Property="Visibility" TargetName="border1_Copy" Value="Visible" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="PART_ButtonBorder" Value="Visible" />
        <Setter Property="Visibility" TargetName="border_Copy" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsSubmenuOpen" Value="True">
        <Setter Property="Visibility" TargetName="border1_Copy" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ApplicationMenuStyle" TargetType="{x:Type Fluent:MenuItem}">
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="ResizeMode" Value="None" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Fluent:FrameworkHelper.UseLayoutRounding" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template" Value="{StaticResource ApplicationMenuItemTemplate}" />
    <Style.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="True" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{StaticResource SplitedApplicationMenuItemTemplate}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="False" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{StaticResource HeaderApplicationMenuItemTemplate}" />
      </MultiTrigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="ApplicationMenuButtonControlTemplate" TargetType="{x:Type Fluent:ApplicationMenu}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource ApplicationMenuStyle}" TargetType="{x:Type Fluent:MenuItem}" />
    </ControlTemplate.Resources>
    <Grid Margin="0,0,0,0">
      <ContentControl x:Name="buttonContent" Width="{Binding ActualWidth, ElementName=PART_ButtonBorder}" Height="{Binding ActualHeight, ElementName=PART_ButtonBorder}" Margin="0,0,0,1">
        <Border x:Name="PART_ButtonBorder" MinWidth="56" Height="23" CornerRadius="2,2,0,0" Background="{TemplateBinding Background}">
          <Border x:Name="border1" BorderThickness="1,1,1,0" CornerRadius="2,2,0,0">
            <Border.BorderBrush>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#997C7C7C" Offset="0" />
                <GradientStop Color="#7F848484" Offset="1" />
              </LinearGradientBrush>
            </Border.BorderBrush>
            <Border x:Name="border" BorderThickness="1,1,1,0" CornerRadius="1,1,0,0">
              <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                  <GradientStop Color="#72FFFFFF" Offset="0" />
                  <GradientStop Color="#4CFFFFFF" Offset="1" />
                </LinearGradientBrush>
              </Border.BorderBrush>
              <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                  <GradientStop Color="#3FFFFFFF" Offset="0" />
                  <GradientStop Offset="1" Color="#3FFFFFFF" />
                  <GradientStop Offset="0.5" />
                </LinearGradientBrush>
              </Border.Background>
              <Grid>
                <Rectangle x:Name="rectangle_Copy" StrokeThickness="0">
                  <Rectangle.Fill>
                    <RadialGradientBrush Center="0.5,0.0" GradientOrigin="0.5,0.0" RadiusX="0.501" RadiusY="0.319">
                      <GradientStop Color="#59FFFFFF" />
                      <GradientStop Offset="1" />
                    </RadialGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
                <Rectangle x:Name="rectangle" StrokeThickness="0">
                  <Rectangle.Fill>
                    <RadialGradientBrush Center="0.5,1.001" GradientOrigin="0.5,1.001" RadiusX="0.496" RadiusY="0.554">
                      <GradientStop Color="#66FFFFFF" Offset="0.018" />
                      <GradientStop Offset="1" />
                    </RadialGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
                <!--<TextBlock Margin="2,0,2,2" Text="{TemplateBinding Header}" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
                <ContentPresenter x:Name="contentPresenter" ContentSource="Header" VerticalAlignment="Center" HorizontalAlignment="Center" />
              </Grid>
            </Border>
          </Border>
        </Border>
      </ContentControl>
      <Popup x:Name="PART_Popup" Placement="Relative" PlacementTarget="{Binding ElementName=buttonContent}" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" MinHeight="17" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" MinWidth="100" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Border Grid.Row="0" Grid.ColumnSpan="2" BorderThickness="0,0,0,1" BorderBrush="{StaticResource ContextMenuSeparatorBrush}" Margin="0" Background="{StaticResource RibbonBackgoundBrush}">
                  <ContentControl x:Name="buttonOnPopupContent" HorizontalAlignment="Left" Margin="-1,-1,0,0" />
                </Border>
                <Fluent:MenuPanel ScrollViewer.VerticalScrollBarVisibility="Auto" Grid.Row="1" Grid.Column="0" x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                <Border Grid.Row="1" Grid.Column="1" BorderThickness="1,0,0,0" BorderBrush="{StaticResource ContextMenuSeparatorBrush}" Width="{TemplateBinding RightPaneWidth}" Background="{StaticResource GalleryBackgroundBrush}">
                  <ContentPresenter ContentSource="RightPaneContent" x:Name="PART_RightContentPresenter" />
                </Border>
                <Border Grid.Row="2" Grid.ColumnSpan="2" BorderThickness="0,1,0,0" BorderBrush="{StaticResource ContextMenuSeparatorBrush}" Background="{StaticResource RibbonBackgoundBrush}" Margin="0">
                  <ContentPresenter ContentSource="FooterPaneContent" />
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="PART_ButtonBorder" Value="0.5" />
        <Setter Property="Effect" TargetName="contentPresenter">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Header" Value="{x:Null}">
        <!--<Setter Property="Tag" TargetName="contentPresenter" Value="pack://application:,,,/Fluent;component\Themes\Office2010\Images\ApplicationMenu.png"/>
              <Setter Property="Content" TargetName="contentPresenter" Value="{Binding Tag, ElementName=contentPresenter, Converter={StaticResource StringToImageConvert}}"/>
              <Setter Property="Width" TargetName="contentPresenter" Value="{Binding Content.Source.Width, ElementName=contentPresenter}"/>
              <Setter Property="Height" TargetName="contentPresenter" Value="{Binding Content.Source.Height, ElementName=contentPresenter}"/>-->
        <Setter Property="Content" TargetName="contentPresenter">
          <Setter.Value>
            <Image Source="pack://application:,,,/Fluent;component\Themes\Office2010\Images\ApplicationMenu.png" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="None" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="border1">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#A07C7C7C" Offset="0" />
              <GradientStop Color="#84848484" Offset="1" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="border">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#4CFFFFFF" Offset="0" />
              <GradientStop Color="#25FFFFFF" Offset="1" />
              <GradientStop Offset="0.5" Color="#19FFFFFF" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#7FFFFFFF" Offset="0" />
              <GradientStop Color="#59FFFFFF" Offset="1" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="Fill" TargetName="rectangle_Copy">
          <Setter.Value>
            <RadialGradientBrush Center="0.5,0" GradientOrigin="0.5,0" RadiusX="0.501" RadiusY="0.319">
              <GradientStop Color="#66FFFFFF" />
              <GradientStop Offset="1" />
            </RadialGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="Fill" TargetName="rectangle">
          <Setter.Value>
            <RadialGradientBrush Center="0.5,1.001" GradientOrigin="0.5,1.001" RadiusX="0.496" RadiusY="0.554">
              <GradientStop Color="#7FFFFFFF" Offset="0.018" />
              <GradientStop Offset="1" />
            </RadialGradientBrush>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="Content" TargetName="buttonContent" Value="{x:Null}" />
        <Setter Property="Content" TargetName="buttonOnPopupContent" Value="{Binding ElementName=PART_ButtonBorder}" />
        <Setter Property="CornerRadius" TargetName="PART_ButtonBorder" Value="0" />
        <Setter Property="CornerRadius" TargetName="border1" Value="0" />
        <Setter Property="CornerRadius" TargetName="border" Value="0" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="rectangle_Copy" Value="Collapsed" />
        <Setter Property="BorderBrush" TargetName="border1">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#99A1A1A1" Offset="0" />
              <GradientStop Color="#7F9A9A9A" Offset="1" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#4CFFFFFF" Offset="0" />
              <GradientStop Color="#72FFFFFF" Offset="1" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="border">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#19FFFFFF" Offset="0" />
              <GradientStop Color="#66FFFFFF" Offset="1" />
              <GradientStop Offset="0.5" Color="#3FFFFFFF" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" SourceName="PART_ButtonBorder" />
          <Condition Property="IsDropDownOpen" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="rectangle" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="rectangle_Copy" Value="Collapsed" />
        <Setter Property="BorderBrush" TargetName="border1">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#A0A1A1A1" Offset="0" />
              <GradientStop Color="#879A9A9A" Offset="1" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" TargetName="border">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#59FFFFFF" Offset="0" />
              <GradientStop Color="#7FFFFFFF" Offset="1" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="Background" TargetName="border">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#26FFFFFF" Offset="0" />
              <GradientStop Color="#7FFFFFFF" Offset="1" />
              <GradientStop Offset="0.5" Color="#4CFFFFFF" />
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:ApplicationMenu}">
    <Setter Property="Template" Value="{StaticResource ApplicationMenuButtonControlTemplate}" />
    <Setter Property="Background" Value="Blue" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Foreground" Value="White" />
  </Style>
  <Style x:Key="RibbonTabControlStyle" TargetType="{x:Type Fluent:RibbonTabControl}">
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="FocusManager.IsFocusScope" Value="False" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Template" Value="{StaticResource RibbonTabControlControlTemplate}" />
  </Style>
  <Style x:Key="RibbonGroupBoxQuickAccessStyle" TargetType="{x:Type Fluent:RibbonGroupBox}">
    <Setter Property="Template" Value="{StaticResource RibbonGroupBoxDropDownButtonControlTemplate}" />
    <Setter Property="Height" Value="22" />
    <Setter Property="Width" Value="22" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="SnapsToDevicePixels" Value="False" />
  </Style>
  <ControlTemplate x:Key="RibbonGroupBoxControlTemplate" TargetType="{x:Type Fluent:RibbonGroupBox}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Storyboard x:Key="OnMouseEnter1">
          <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="hoverGrid" Storyboard.TargetProperty="(UIElement.Opacity)">
            <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1" />
          </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="OnMouseLeave1">
          <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="hoverGrid" Storyboard.TargetProperty="(UIElement.Opacity)">
            <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0" />
          </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Style TargetType="Separator" BasedOn="{StaticResource GroupBoxSeparator}" />
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid x:Name="grid2" HorizontalAlignment="Stretch">
      <Grid Background="#00000000">
        <Grid x:Name="hoverGrid" Background="{StaticResource GroupHoverBrush}" HorizontalAlignment="Stretch" Margin="0,0,1,1" VerticalAlignment="Stretch" Width="Auto" Height="Auto" ClipToBounds="True" Opacity="0" Grid.RowSpan="2">
          <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Fill="{StaticResource GroupHighlightBrush}" />
        </Grid>
        <ContentControl x:Name="border1" Focusable="False">
          <Grid x:Name="PART_ParentPanel" Margin="0,1,0,2" Grid.RowSpan="2" Height="85">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="17" />
            </Grid.RowDefinitions>
            <Grid x:Name="PART_DownGrid" MaxWidth="{Binding ActualWidth, ElementName=PART_UpPanel}" Margin="0,-2,2,2" Grid.Row="1" VerticalAlignment="Bottom" Height="17">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
              </Grid.ColumnDefinitions>
              <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{TemplateBinding Header}" TextWrapping="NoWrap" Grid.Row="1" Foreground="{StaticResource GroupBoxFontBrush}" Margin="2,0" TextTrimming="CharacterEllipsis" TextAlignment="Center" />
              <Fluent:Button Margin="0,0,1,1" x:Name="PART_DialogLauncherButton" HorizontalAlignment="Stretch" Width="15" Height="14" Grid.Column="1" Focusable="False" IsTabStop="False" Template="{StaticResource DialogLauncherButtonControlTemplate}" VerticalAlignment="Bottom" Icon="{TemplateBinding LauncherIcon}" Header="{TemplateBinding LauncherText}" Command="{Binding LauncherCommand, RelativeSource={RelativeSource TemplatedParent}}" CommandTarget="{Binding LauncherCommandTarget, RelativeSource={RelativeSource TemplatedParent}}" CommandParameter="{Binding LauncherCommandParameter, RelativeSource={RelativeSource TemplatedParent}}" ToolTip="{Binding LauncherToolTip, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsLauncherEnabled, RelativeSource={RelativeSource TemplatedParent}}" />
            </Grid>
            <WrapPanel x:Name="PART_UpPanel" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="Auto" Height="Auto" IsItemsHost="True" Margin="2,0,4,0" Orientation="Vertical" FocusManager.IsFocusScope="False" />
          </Grid>
        </ContentControl>
        <Grid x:Name="grid1" Margin="0" Width="Auto" Height="Auto" Background="#00000000" Visibility="Collapsed" Grid.RowSpan="2">
          <Fluent:TwoLineLabel HorizontalAlignment="Center" VerticalAlignment="Top" Text="{TemplateBinding Header}" Margin="5,38,5,0" HasGlyph="True" HasTwoLines="True" Style="{StaticResource TwoLineLabelStyle}" />
          <Border HorizontalAlignment="Center" VerticalAlignment="Top" Width="31" Height="31" BorderBrush="#FFD0D4D9" BorderThickness="1" Margin="5,3,8,0" CornerRadius="3">
            <ContentPresenter x:Name="iconImage" Height="16" Content="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="16" SnapsToDevicePixels="True" />
          </Border>
          <Popup x:Name="PART_Popup" Width="Auto" Height="Auto" AllowsTransparency="True" PlacementTarget="{Binding ElementName=grid1, Mode=OneWay}" StaysOpen="True" IsOpen="{TemplateBinding IsDropDownOpen}">
            <Grid Width="Auto" Height="Auto" Margin="0,20">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="5" />
              </Grid.ColumnDefinitions>
              <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="5" />
              </Grid.RowDefinitions>
              <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="11,-1,1,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1">
                <Rectangle.Fill>
                  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                    <GradientStop Color="#7F000000" Offset="0" />
                    <GradientStop Offset="1" />
                  </LinearGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,11,0,1" VerticalAlignment="Stretch" Height="Auto" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1">
                <Rectangle.Fill>
                  <LinearGradientBrush EndPoint="1.002,0" MappingMode="RelativeToBoundingBox">
                    <GradientStop Color="#7F000000" Offset="0" />
                    <GradientStop Offset="1" />
                  </LinearGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,-1,0,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="1" Grid.Row="1" Grid.RowSpan="1">
                <Rectangle.Fill>
                  <RadialGradientBrush Center="-0.003,0.011" GradientOrigin="-0.003,0.011" RadiusX="1.006" RadiusY="1">
                    <GradientStop Color="#7F000000" Offset="0.002" />
                    <GradientStop Offset="1" />
                  </RadialGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,5,0,0" VerticalAlignment="Top" Height="6" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1">
                <Rectangle.Fill>
                  <RadialGradientBrush Center="-0.01,1.004" GradientOrigin="-0.01,1.004" RadiusX="1.006" RadiusY="1">
                    <GradientStop Color="#7F000000" Offset="0.002" />
                    <GradientStop Offset="1" />
                  </RadialGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Left" Margin="5,-1,0,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1" Width="6">
                <Rectangle.Fill>
                  <RadialGradientBrush Center="1.003,-0.006" GradientOrigin="1.003,-0.006" RadiusX="1.006" RadiusY="1">
                    <GradientStop Color="#7F000000" Offset="0.002" />
                    <GradientStop Offset="1" />
                  </RadialGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Border x:Name="border" Height="Auto" Grid.RowSpan="1" Background="{StaticResource RibbonBackgoundBrush}" BorderBrush="{StaticResource RibbonTopBorderBrush}" BorderThickness="1" CornerRadius="1" d:LayoutOverrides="Width">
                <ContentControl x:Name="popupContent" />
              </Border>
            </Grid>
          </Popup>
        </Grid>
        <Border x:Name="separator" BorderBrush="{StaticResource GroupSeparatorBorderBrush}" Background="{StaticResource GroupSeparatorBackgroundBrush}" HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="3" Height="Auto" Grid.RowSpan="2" BorderThickness="1,0" />
      </Grid>
      <Image x:Name="PART_SnappedImage" Visibility="Collapsed" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="State" Value="Collapsed">
        <Setter Property="Visibility" TargetName="grid1" Value="Visible" />
        <Setter Property="UIElement.Visibility" TargetName="border1" Value="Collapsed" />
        <Setter Property="HorizontalAlignment" TargetName="grid2" Value="Left" />
        <Setter Property="Content" TargetName="border1" Value="{x:Null}" />
        <Setter Property="Content" TargetName="popupContent" Value="{Binding ElementName=PART_ParentPanel}" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True" />
      <Trigger Property="IsDropDownOpen" Value="True">
        <Trigger.EnterActions>
          <BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard" Storyboard="{StaticResource OnMouseEnter1}" />
        </Trigger.EnterActions>
        <Trigger.ExitActions>
          <BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}" />
        </Trigger.ExitActions>
      </Trigger>
      <Trigger Property="IsLauncherVisible" Value="False">
        <Setter Property="Visibility" TargetName="PART_DialogLauncherButton" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonDropDownButtonControlTemplate" TargetType="{x:Type Fluent:DropDownButton}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
    </ControlTemplate.Resources>
    <Grid>
      <Border x:Name="PART_ButtonBorder" BorderThickness="1" Background="{StaticResource TransparentBrush}" BorderBrush="{StaticResource TransparentBrush}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Stretch" d:LayoutOverrides="Width, Height">
        <Grid Height="Auto">
          <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Vertical" d:LayoutOverrides="Width, Height">
            <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Width="32" Margin="3,2" SnapsToDevicePixels="True" />
            <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" Style="{StaticResource TwoLineLabelStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,-2,2,2" HasGlyph="{TemplateBinding HasTriangle}" />
          </StackPanel>
        </Grid>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="#00000000" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                <ScrollViewer x:Name="PART_ScrollViewer" Style="{StaticResource MenuScrollViewer}" IsTabStop="False" Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Local" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" CornerRadius="0,0,1,1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,0,0" />
        <Setter Property="Margin" TargetName="controlLabel" Value="-2,-1,2,1" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-1,2,1" />
        <Setter Property="VerticalAlignment" TargetName="PART_ButtonBorder" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedOuterBackgroundBrush}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsFocused" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
  <ControlTemplate x:Key="RibbonSplitButtonControlTemplate" TargetType="{x:Type Fluent:SplitButton}">
    <Grid>
      <Border BorderThickness="1" Name="PART_ButtonBorder" BorderBrush="{StaticResource TransparentBrush}" Background="{StaticResource TransparentBrush}">
        <StackPanel Orientation="Vertical" Name="stackPanel">
          <Fluent:ToggleButton x:Name="PART_Button" Command="{TemplateBinding Command}" CommandParameter="{TemplateBinding CommandParameter}" CommandTarget="{TemplateBinding CommandTarget}" Margin="0,0,0,0" Height="Auto" Width="Auto" Style="{StaticResource InnerButtonStyle}" LargeIcon="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" Icon="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToImageConvert}}" IsEnabled="{TemplateBinding IsButtonEnabled}" Header="{TemplateBinding Header}" ToolTip="{TemplateBinding ToolTip}" IsChecked="{Binding IsChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsDefinitive="{TemplateBinding IsDefinitive}" CanAddToQuickAccessToolBar="{TemplateBinding CanAddButtonToQuickAccessToolBar}" />
          <Border BorderThickness="0,1,0,0" Name="downBorder" BorderBrush="{StaticResource TransparentBrush}" Background="{StaticResource TransparentBrush}" Margin="0,0,0,0">
            <Grid>
              <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" Style="{StaticResource TwoLineLabelStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,0,2,0" HasGlyph="{TemplateBinding HasTriangle}" />
              <!--<ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" 
                                              	VerticalAlignment="Center" MinWidth="10" Margin="3,2" SnapsToDevicePixels="True"
                                              	IsHitTestVisible="false" Visibility="Hidden" />-->
            </Grid>
          </Border>
        </StackPanel>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1" />
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0" />
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                <ScrollViewer x:Name="PART_ScrollViewer" Style="{StaticResource MenuScrollViewer}" Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                  <Fluent:MenuPanel x:Name="PART_MenuPanel" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" CornerRadius="0,0,1,1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedOuterBorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Size" TargetName="PART_Button" Value="Small" />
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
        <Setter Property="Margin" TargetName="controlLabel" Value="0,-19,0,0" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
        <Setter Property="Margin" TargetName="downBorder" Value="0" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Size" TargetName="PART_Button" Value="Middle" />
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
        <Setter Property="Margin" TargetName="controlLabel" Value="0,-19,0,0" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
        <Setter Property="Margin" TargetName="downBorder" Value="0" />
      </Trigger>
      <Trigger Property="IsButtonEnabled" Value="False">
        <Setter Property="IsEnabled" TargetName="PART_Button" Value="False" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedInnerBackgroundBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonPressedInnerBorderBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" SourceName="PART_Button" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" SourceName="downBorder" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{StaticResource ButtonHoverInnerBorderBrush}" />
        <Setter Property="Background" TargetName="downBorder" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
        <Setter Property="BorderBrush" TargetName="downBorder" Value="{StaticResource ButtonHoverOuterBorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="QuickAccessToolbarControlTemplate" TargetType="{x:Type Fluent:QuickAccessToolBar}">
    <DockPanel x:Name="PART_RootPanel">
      <ContentControl x:Name="menuContentControl" DockPanel.Dock="Right" HorizontalAlignment="Right" Focusable="False">
        <Fluent:DropDownButton CanAddToQuickAccessToolBar="False" x:Name="PART_MenuDownButton" Width="13" HorizontalAlignment="Right" VerticalAlignment="Stretch" Style="{StaticResource ToolbarDropDownButtonStyle}" Height="22" DockPanel.Dock="Right" IsEnabled="{TemplateBinding IsEnabled}" Icon="pack://application:,,,/Fluent;Component/Themes/Office2010/Images/QuickAccessToolBarDropDown.png" Size="Small" ToolTip="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=QuickAccessToolBarDropDownButtonTooltip, Mode=OneWay}">
          <Fluent:GroupSeparatorMenuItem Style="{StaticResource MenuGroupSeparatorStyle}" Header="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=QuickAccessToolBarMenuHeader, Mode=OneWay}" />
          <StackPanel x:Name="PART_MenuPanel" />
          <Separator x:Name="menuSeparator" Style="{StaticResource MenuSeparatorStyle}" />
          <Fluent:MenuItem x:Name="PART_ShowBelow" Header="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=QuickAccessToolBarMenuShowBelow, Mode=OneWay}" />
          <Fluent:MenuItem x:Name="PART_ShowAbove" Header="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=QuickAccessToolBarMenuShowAbove, Mode=OneWay}" Visibility="Collapsed" />
        </Fluent:DropDownButton>
      </ContentControl>
      <Fluent:DropDownButton x:Name="PART_ToolbarDownButton" HorizontalAlignment="Right" Width="13" Visibility="Collapsed" VerticalAlignment="Stretch" Style="{StaticResource ToolbarDropDownButtonStyle}" Height="22" DockPanel.Dock="Right" Fluent:KeyTip.Keys="00" Size="Small" IsEnabled="{TemplateBinding IsEnabled}" Icon="pack://application:,,,/Fluent;Component/Themes/Office2010/Images/QuickAccessToolBarExtender.png" ToolTip="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=QuickAccessToolBarMoreControlsButtonTooltip, Mode=OneWay}">
        <Fluent:DropDownButton.ContextMenu>
          <ContextMenu />
        </Fluent:DropDownButton.ContextMenu>
        <StackPanel Orientation="Horizontal" Background="{StaticResource QuickAccessToolbarPopupBackgrondBrush}" Width="Auto" Height="26" Margin="-1">
          <StackPanel Orientation="Horizontal" x:Name="PART_ToolBarOverflowPanel" HorizontalAlignment="Left" Width="Auto" Height="Auto" VerticalAlignment="Center" Margin="1,0,0,0" />
          <Label x:Name="popupContentControl" VerticalAlignment="Center" HorizontalAlignment="Left" Width="13" Background="{x:Null}" Height="22" Focusable="False" Padding="0" Margin="1,0" />
        </StackPanel>
      </Fluent:DropDownButton>
      <Rectangle x:Name="rectangle" Fill="Black" Stroke="White" RadiusX="1" RadiusY="1" HorizontalAlignment="Right" Width="3" Height="15" Opacity="0.5" VerticalAlignment="Stretch" DockPanel.Dock="Right" />
      <Rectangle x:Name="rectangle1" Fill="Black" Stroke="White" Width="3" Height="15" RadiusX="1" RadiusY="1" HorizontalAlignment="Left" Opacity="0.5" VerticalAlignment="Stretch" DockPanel.Dock="Left" />
      <StackPanel Orientation="Horizontal" x:Name="PART_ToolBarPanel" Width="Auto" Height="Auto" VerticalAlignment="Stretch" FocusManager.IsFocusScope="False" />
    </DockPanel>
    <ControlTemplate.Triggers>
      <Trigger Property="CanQuickAccessLocationChanging" Value="False">
        <Setter Property="Visibility" TargetName="PART_ShowBelow" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ShowAbove" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="menuSeparator" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ShowAboveRibbon" Value="False">
        <Setter Property="Visibility" TargetName="PART_ShowBelow" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ShowAbove" Value="Visible" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="rectangle1" Value="Collapsed" />
      </Trigger>
      <Trigger Property="HasOverflowItems" Value="True">
        <Setter Property="Visibility" TargetName="PART_ToolbarDownButton" Value="Visible" />
        <Setter Property="Content" TargetName="popupContentControl" Value="{Binding ElementName=PART_MenuDownButton, Mode=OneWay}" />
        <Setter Property="Content" TargetName="menuContentControl" Value="{x:Null}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="FluentPopupMenuControlTemplate" TargetType="{x:Type Fluent:ContextMenu}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
      <Style TargetType="{x:Type Fluent:GroupSeparatorMenuItem}" BasedOn="{StaticResource MenuGroupSeparatorStyle}" />
    </ControlTemplate.Resources>
    <Grid Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="10" />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="10" />
      </Grid.ColumnDefinitions>
      <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
        <Rectangle.Fill>
          <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
        <Rectangle.Fill>
          <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
        <Rectangle.Fill>
          <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
        <Rectangle.Fill>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </LinearGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
        <Rectangle.Fill>
          <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </LinearGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Border SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Grid Width="Auto" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
          <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
          <Grid Margin="1" HorizontalAlignment="Left" VerticalAlignment="Top">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{StaticResource ContextMenuLineBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" />
            <ScrollViewer x:Name="PART_ScrollViewer" Style="{StaticResource MenuScrollViewer}" Margin="1" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
              <Fluent:MenuPanel IsItemsHost="True" Margin="0" Width="Auto" Height="Auto" d:LayoutOverrides="Width, Height" Grid.RowSpan="1" x:Name="PART_ItemsHost" HorizontalAlignment="Left" VerticalAlignment="Top" />
            </ScrollViewer>
            <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{StaticResource ContextMenuBarResizeBorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" CornerRadius="0,0,1,1" Background="{StaticResource ContextMenuBarResizeBackgoundBrush}">
              <Grid>
                <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{StaticResource ResizeVerticalThumbControlTemplate}" />
                <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{StaticResource ResizeBothThumbControlTemplate}" />
              </Grid>
            </Border>
          </Grid>
        </Grid>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="FlowDirection" Value="RightToLeft">
        <Setter Property="Cursor" TargetName="PART_ResizeBothThumb" Value="SizeNESW" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="PopupMenuControlTemplate" TargetType="{x:Type ContextMenu}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
      <Style TargetType="{x:Type Fluent:GroupSeparatorMenuItem}" BasedOn="{StaticResource MenuGroupSeparatorStyle}" />
    </ControlTemplate.Resources>
    <Grid Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="10" />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="10" />
      </Grid.ColumnDefinitions>
      <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
        <Rectangle.Fill>
          <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
        <Rectangle.Fill>
          <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
        <Rectangle.Fill>
          <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </RadialGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
        <Rectangle.Fill>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </LinearGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
        <Rectangle.Fill>
          <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
            <GradientStop Color="#3F000000" Offset="0" />
            <GradientStop Color="#00000000" Offset="1" />
          </LinearGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
      <Border SnapsToDevicePixels="True" Background="{StaticResource ContextMenuBarBackgroundBrush}" BorderBrush="{StaticResource ContextMenuBarBorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Grid Width="Auto" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
          <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{StaticResource ContextMenuBarBackgroundBrush}" BorderThickness="1" CornerRadius="1" />
          <Grid Margin="1" HorizontalAlignment="Left" VerticalAlignment="Top">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{StaticResource ContextMenuLineBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" />
            <ScrollViewer x:Name="PART_ScrollViewer" Style="{StaticResource MenuScrollViewer}" Margin="1" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
              <StackPanel Margin="0" Width="Auto" Height="Auto" IsItemsHost="True" d:LayoutOverrides="Width, Height" Grid.RowSpan="1" x:Name="PART_ItemsHost" HorizontalAlignment="Left" VerticalAlignment="Top" />
            </ScrollViewer>
          </Grid>
        </Grid>
      </Border>
    </Grid>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:ComboBox}" x:Key="ComboBoxBackstageStyle">
    <Setter Property="Template" Value="{StaticResource ComboBoxBackstageControlTemplate}" />
    <Setter Property="Height" Value="42" />
    <Setter Property="Width" Value="229" />
    <Setter Property="IsReadOnly" Value="True" />
    <Setter Property="IsEditable" Value="False" />
    <Setter Property="MaxDropDownHeight" Value="{x:Static System:Double.PositiveInfinity}" />
  </Style>
  <ControlTemplate x:Key="BackstageControlTemplate" TargetType="{x:Type Fluent:BackstageTabControl}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type Fluent:Button}" TargetType="{x:Type Fluent:Button}" BasedOn="{StaticResource BackstageButtonStyle}" />
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
        <Style x:Key="{x:Type Fluent:DropDownButton}" TargetType="{x:Type Fluent:DropDownButton}" BasedOn="{StaticResource DropDownButtonBackstageStyle}" />
        <Style x:Key="{x:Type Fluent:ComboBox}" TargetType="{x:Type Fluent:ComboBox}" BasedOn="{StaticResource ComboBoxBackstageStyle}" />
        <Style x:Key="{x:Type Fluent:Spinner}" TargetType="{x:Type Fluent:Spinner}" BasedOn="{StaticResource SpinnerBackstageStyle}" />
        <Style TargetType="{x:Type Fluent:SeparatorTabItem}" BasedOn="{StaticResource BackstageSeparatorTabItemStyle}" />
        <Storyboard x:Key="OnIsOpenTrueStoryboard">
          <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="grid">
            <Fluent:EasingThicknessKeyFrame KeyTime="0" Value="-30,0,0,0" />
            <Fluent:EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="0">
              <Fluent:EasingThicknessKeyFrame.EasingFunction>
                <Fluent:CubicEase EasingMode="EaseInOut" />
              </Fluent:EasingThicknessKeyFrame.EasingFunction>
            </Fluent:EasingThicknessKeyFrame>
          </ThicknessAnimationUsingKeyFrames>
          <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="grid">
            <Fluent:EasingDoubleKeyFrame KeyTime="0" Value="0" />
            <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
          </DoubleAnimationUsingKeyFrames>
          <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="backbutton">
            <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="-23" />
            <Fluent:EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
          </DoubleAnimationUsingKeyFrames>
        </Storyboard>
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid x:Name="grid" Margin="0" Background="{StaticResource BackstageBackgroundBrush}">
      <Grid.ColumnDefinitions>
        <ColumnDefinition MinWidth="115" Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid Height="Auto" Grid.Column="1">
        <Grid.Resources>
          <ResourceDictionary>
            <Style x:Key="{x:Type Fluent:Button}" TargetType="{x:Type Fluent:Button}" BasedOn="{StaticResource BackstageButtonStyle}" />
          </ResourceDictionary>
        </Grid.Resources>
        <ContentPresenter x:Name="PART_SelectedContentHost" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Grid.Column="1" ContentSource="SelectedContent" />
      </Grid>
      <Grid Margin="0,-25,0,0" VerticalAlignment="Stretch" Background="{Binding RibbonThemeColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:MetroWindow}}}">
        <Grid Width="35" Height="35" Fluent:FrameworkHelper.UseLayoutRounding="False" Margin="22,19,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" x:Name="backbutton" RenderTransformOrigin="0.5,0.5">
          <Grid.RenderTransform>
            <TransformGroup>
              <ScaleTransform />
              <SkewTransform />
              <RotateTransform />
              <TranslateTransform />
            </TransformGroup>
          </Grid.RenderTransform>
          <Path x:Name="arrowpath" Width="16" Height="12" Canvas.Top="10" Canvas.Left="7.5" Stretch="Uniform" Fill="White" Data="F1 M 36,22L 36,26L 19.75,26L 27,33L 20.5,33L 11,24L 20.5,15L 27,15L 19.75,22L 36,22 Z " />
          <Ellipse x:Name="backellipse" Stroke="White" Height="35" Canvas.Left="0" Width="35" StrokeThickness="2" />
          <Path Data="M0,0 C0,35 0,35 0,35 C0,35 35,35 35,35 L35,0 z" Fill="Transparent" HorizontalAlignment="Stretch" Margin="0" Stretch="None" Width="Auto" />
          <Interactivity:Interaction.Triggers>
            <Interactivity:EventTrigger EventName="MouseLeftButtonDown" SourceName="backbutton">
              <Internal:InvokeCommand Command="{x:Static Fluent:RibbonCommands.OpenBackstage}" />
            </Interactivity:EventTrigger>
          </Interactivity:Interaction.Triggers>
        </Grid>
        <ItemsPresenter Margin="0,69,0,0" Height="Auto" />
      </Grid>
    </Grid>
    <ControlTemplate.Triggers>
      <DataTrigger Binding="{Binding IsOpen, RelativeSource={RelativeSource AncestorType={x:Type Fluent:Backstage}}}" Value="True">
        <DataTrigger.EnterActions>
          <BeginStoryboard x:Name="IsOpenBeginStoryboard" Storyboard="{StaticResource OnIsOpenTrueStoryboard}" />
        </DataTrigger.EnterActions>
        <DataTrigger.ExitActions>
          <RemoveStoryboard BeginStoryboardName="IsOpenBeginStoryboard" />
        </DataTrigger.ExitActions>
      </DataTrigger>
      <Trigger Property="IsMouseOver" Value="True" SourceName="backbutton">
        <Setter Property="Opacity" TargetName="arrowpath" Value="0.5" />
        <Setter Property="Opacity" TargetName="backellipse" Value="0.5" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="BackstageStyle" TargetType="{x:Type Fluent:BackstageTabControl}">
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Template" Value="{StaticResource BackstageControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="Margin" Value="0,-24,0,0" />
    <Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:Backstage}}, FallbackValue=Red}" />
    <Setter Property="ItemsPanelBackground" Value="{StaticResource BackstagePanelBackgroundBrush}" />
  </Style>
  <Style x:Key="{x:Type Fluent:BackstageTabControl}" TargetType="{x:Type Fluent:BackstageTabControl}" BasedOn="{StaticResource BackstageStyle}" />
  <Style x:Key="RibbonGroupBoxStyle" TargetType="{x:Type Fluent:RibbonGroupBox}">
    <Setter Property="Template" Value="{StaticResource RibbonGroupBoxControlTemplate}" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Height" Value="85" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="FocusManager.IsFocusScope" Value="False" />
    <!--<Setter Property="QuickAccessElementStyle" Value="{DynamicResource RibbonGroupBoxQuickAccessStyle}"/>-->
    <Style.Triggers>
      <Trigger Property="State" Value="QuickAccess">
        <Setter Property="Template" Value="{StaticResource RibbonGroupBoxDropDownButtonControlTemplate}" />
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="22" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
        <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
        <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
        <Setter Property="SnapsToDevicePixels" Value="False" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="RibbonDropDownButtonStyle" TargetType="{x:Type Fluent:DropDownButton}">
    <Setter Property="Template" Value="{StaticResource RibbonDropDownButtonControlTemplate}" />
    <Setter Property="Height" Value="66" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="SnapsToDevicePixels" Value="False" />
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Height" Value="66" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Height" Value="22" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="31" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="RibbonSplitButtonStyle" TargetType="{x:Type Fluent:SplitButton}">
    <Setter Property="Template" Value="{StaticResource RibbonSplitButtonControlTemplate}" />
    <Setter Property="Height" Value="66" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Height" Value="66" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Height" Value="22" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="34" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="QuickAccessToolbarStyle" TargetType="{x:Type Fluent:QuickAccessToolBar}">
    <Setter Property="Template" Value="{StaticResource QuickAccessToolbarControlTemplate}" />
    <Setter Property="FocusManager.IsFocusScope" Value="False" />
  </Style>
  <Style TargetType="{x:Type Fluent:ContextMenu}">
    <Setter Property="Template" Value="{StaticResource FluentPopupMenuControlTemplate}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="MinWidth" Value="0" />
    <Setter Property="MinHeight" Value="0" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Top" />
  </Style>
  <Style TargetType="{x:Type ContextMenu}">
    <Setter Property="Template" Value="{StaticResource PopupMenuControlTemplate}" />
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="MinWidth" Value="0" />
    <Setter Property="MinHeight" Value="0" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Top" />
  </Style>
  <ControlTemplate x:Key="RibbonControlTemplate" TargetType="{x:Type Fluent:Ribbon}">
    <Grid x:Name="PART_LayoutRoot" Width="Auto" Height="Auto">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <Fluent:RibbonTitleBar x:Name="PART_RibbonTitleBar" Height="25" Style="{StaticResource RibbonTitleBarStyle}" Margin="20,0,113,0" VerticalAlignment="Top" IsCollapsed="{TemplateBinding IsCollapsed}">
        <Fluent:RibbonTitleBar.Header>
          <TextBlock x:Name="PART_Title" Margin="-2,0" VerticalAlignment="Center" d:LayoutOverrides="Width" HorizontalAlignment="Center" Text="{Binding Path=Title,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Foreground="Black" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
        </Fluent:RibbonTitleBar.Header>
      </Fluent:RibbonTitleBar>
      <Fluent:RibbonTabControl Menu="{TemplateBinding Menu}" Style="{StaticResource RibbonTabControlStyle}" x:Name="PART_RibbonTabControl" Margin="0,25,0,0" Focusable="False" ContextMenu="{Binding ContextMenu, ElementName=PART_LayoutRoot}" />
      <!--<ContentPresenter x:Name="button" Margin="2,26,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"
                          ContentSource="Menu"/>-->
      <Border x:Name="border" Margin="0,-2,0,0" BorderBrush="{StaticResource QuickAccessToolBarOutterBorderBrush}" BorderThickness="0,1" Grid.Row="1" Height="26">
        <Border BorderBrush="{StaticResource QuickAccessToolBarInnerBorderBrush}" BorderThickness="0,1" Background="{StaticResource QuickAccessToolBarInnerBackgroundBrush}">
          <ContentControl x:Name="contentControl" HorizontalAlignment="Left">
            <Fluent:QuickAccessToolBar x:Name="PART_QuickAccessToolBar" Style="{StaticResource QuickAccessToolbarStyle}" ShowAboveRibbon="{Binding ShowQuickAccessToolBarAboveRibbon, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Left" Focusable="False" />
          </ContentControl>
        </Border>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsQuickAccessToolBarVisible" Value="False">
        <Setter Property="Visibility" TargetName="border" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_QuickAccessToolBar" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsCollapsed" Value="True">
        <Setter Property="Visibility" TargetName="PART_RibbonTabControl" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="border" Value="Collapsed" />
        <!-- Setting height to the exact same value as GlassBorderThickness -->
        <Setter Property="Height" TargetName="PART_RibbonTitleBar" Value="{Binding GlassBorderThickness.Top, RelativeSource={RelativeSource AncestorType={x:Type Fluent:RibbonWindow}}, FallbackValue=30}" />
      </Trigger>
      <Trigger Property="ShowQuickAccessToolBarAboveRibbon" Value="True">
        <Setter Property="Content" TargetName="contentControl" Value="{x:Null}" />
        <Setter Property="QuickAccessToolBar" TargetName="PART_RibbonTitleBar" Value="{Binding ElementName=PART_QuickAccessToolBar, Mode=OneWay}" />
        <Setter Property="Visibility" TargetName="border" Value="Collapsed" />
        <Setter Property="Margin" TargetName="PART_QuickAccessToolBar" Value="0,2,0,0" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonStyle" TargetType="{x:Type Fluent:Ribbon}">
    <Setter Property="Foreground" Value="{StaticResource DefaultFontBrush}" />
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
    <Setter Property="Template" Value="{StaticResource RibbonControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource ControlStyleEmptyFocus}" />
    <Setter Property="FocusManager.IsFocusScope" Value="False" />
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Fluent:FrameworkHelper.UseLayoutRounding" Value="True" />
    <Setter Property="Margin" Value="0,-30,0,0" />
  </Style>
  <Style x:Key="{x:Type Fluent:DropDownButton}" TargetType="{x:Type Fluent:DropDownButton}" BasedOn="{StaticResource RibbonDropDownButtonStyle}" />
  <Style x:Key="{x:Type Fluent:SplitButton}" TargetType="{x:Type Fluent:SplitButton}" BasedOn="{StaticResource RibbonSplitButtonStyle}" />
  <Style x:Key="{x:Type Fluent:RibbonGroupBox}" TargetType="{x:Type Fluent:RibbonGroupBox}" BasedOn="{StaticResource RibbonGroupBoxStyle}" />
  <Style x:Key="{x:Type Fluent:Ribbon}" TargetType="{x:Type Fluent:Ribbon}" BasedOn="{StaticResource RibbonStyle}" />
</ResourceDictionary>